Skip to content

Commit

Permalink
Updates jquery and socket.io inclusions (#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
sillyfrog authored and miguelgrinberg committed May 29, 2019
1 parent d8a4679 commit 67da0d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ production servers, but this functionality has been discontinued in favor of the
The application must serve a page to the client that loads the Socket.IO
library and establishes a connection::

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js" integrity="sha256-yr4fRk/GU1ehYJPAs8P4JlTgu0Hdsp4ZKrx8bDEDC3I=" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
var socket = io();
socket.on('connect', function() {
socket.emit('my event', {data: 'I\'m connected!'});
});
Expand Down
8 changes: 4 additions & 4 deletions example/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<html>
<head>
<title>Flask-SocketIO Test</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script>
<script src="//code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js" integrity="sha256-yr4fRk/GU1ehYJPAs8P4JlTgu0Hdsp4ZKrx8bDEDC3I=" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Use a "/test" namespace.
Expand All @@ -14,9 +14,9 @@
namespace = '/test';

// Connect to the Socket.IO server.
// The connection URL has the following format:
// The connection URL has the following format, relative to the current page:
// http[s]://<domain>:<port>[/<namespace>]
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + namespace);
var socket = io(namespace);

// Event handler for new connections.
// The callback function is invoked when a connection with the
Expand Down
7 changes: 4 additions & 3 deletions example/templates/sessions.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<head>
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.slim.js"></script>
<title>Flask-SocketIO Sessions example</title>
<script src="//code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js" integrity="sha256-yr4fRk/GU1ehYJPAs8P4JlTgu0Hdsp4ZKrx8bDEDC3I=" crossorigin="anonymous"></script>
</head>
<body>
<div class="pure-g">
Expand Down Expand Up @@ -105,7 +106,7 @@ <h2>Socket.IO</h2>

$('#connect').click(function() {
if (!socket) {
socket = io.connect(location.href);
socket = io();
socket.on('refresh-session', function(data) {
$('#socketio-session').text(data['session']);
$('#socketio-user').text(data['user']);
Expand Down

0 comments on commit 67da0d6

Please sign in to comment.