Browse Source

examples

pull/1422/head
Miguel Grinberg 4 months ago
parent
commit
ab35d0831d
Failed to extract signature
  1. 4
      examples/client/async/fiddle_client.py
  2. 4
      examples/client/sync/fiddle_client.py
  3. 4
      examples/server/aiohttp/app.html
  4. 6
      examples/server/aiohttp/app.py
  5. 6
      examples/server/aiohttp/fiddle.py
  6. 4
      examples/server/asgi/app.html
  7. 4
      examples/server/asgi/app.py
  8. 4
      examples/server/asgi/fiddle.py
  9. 4
      examples/server/javascript/fiddle.js
  10. 4
      examples/server/sanic/app.html
  11. 4
      examples/server/sanic/app.py
  12. 4
      examples/server/sanic/fiddle.py
  13. 4
      examples/server/tornado/app.py
  14. 4
      examples/server/tornado/fiddle.py
  15. 4
      examples/server/tornado/templates/app.html
  16. 4
      examples/server/wsgi/app.py
  17. 4
      examples/server/wsgi/django_socketio/socketio_app/static/index.html
  18. 4
      examples/server/wsgi/django_socketio/socketio_app/views.py
  19. 4
      examples/server/wsgi/fiddle.py
  20. 4
      examples/server/wsgi/templates/index.html

4
examples/client/async/fiddle_client.py

@ -10,8 +10,8 @@ async def connect():
@sio.event
async def disconnect():
print('disconnected from server')
async def disconnect(reason):
print('disconnected from server, reason:', reason)
@sio.event

4
examples/client/sync/fiddle_client.py

@ -9,8 +9,8 @@ def connect():
@sio.event
def disconnect():
print('disconnected from server')
def disconnect(reason):
print('disconnected from server, reason:', reason)
@sio.event

4
examples/server/aiohttp/app.html

@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
socket.on('disconnect', function() {
$('#log').append('<br>Disconnected');
socket.on('disconnect', function(reason) {
$('#log').append('<br>Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('<br>Received: ' + msg.data);

6
examples/server/aiohttp/app.py

@ -70,8 +70,8 @@ async def connect(sid, environ):
@sio.event
def disconnect(sid):
print('Client disconnected')
def disconnect(sid, reason):
print('Client disconnected, reason:', reason)
app.router.add_static('/static', 'static')
@ -84,4 +84,4 @@ async def init_app():
if __name__ == '__main__':
web.run_app(init_app())
web.run_app(init_app(), port=5000)

6
examples/server/aiohttp/fiddle.py

@ -19,8 +19,8 @@ async def connect(sid, environ, auth):
@sio.event
def disconnect(sid):
print('disconnected', sid)
def disconnect(sid, reason):
print('disconnected', sid, reason)
app.router.add_static('/static', 'static')
@ -28,4 +28,4 @@ app.router.add_get('/', index)
if __name__ == '__main__':
web.run_app(app)
web.run_app(app, port=5000)

4
examples/server/asgi/app.html

@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
socket.on('disconnect', function() {
$('#log').append('<br>Disconnected');
socket.on('disconnect', function(reason) {
$('#log').append('<br>Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('<br>Received: ' + msg.data);

4
examples/server/asgi/app.py

@ -88,8 +88,8 @@ async def test_connect(sid, environ):
@sio.on('disconnect')
def test_disconnect(sid):
print('Client disconnected')
def test_disconnect(sid, reason):
print('Client disconnected, reason:', reason)
if __name__ == '__main__':

4
examples/server/asgi/fiddle.py

@ -17,8 +17,8 @@ async def connect(sid, environ, auth):
@sio.event
def disconnect(sid):
print('disconnected', sid)
def disconnect(sid, reason):
print('disconnected', sid, reason)
if __name__ == '__main__':

4
examples/server/javascript/fiddle.js

@ -19,8 +19,8 @@ io.on('connection', socket => {
hello: 'you'
});
socket.on('disconnect', () => {
console.log(`disconnect ${socket.id}`);
socket.on('disconnect', (reason) => {
console.log(`disconnect ${socket.id}, reason: ${reason}`);
});
});

4
examples/server/sanic/app.html

@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
socket.on('disconnect', function() {
$('#log').append('<br>Disconnected');
socket.on('disconnect', function(reason) {
$('#log').append('<br>Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('<br>Received: ' + msg.data);

4
examples/server/sanic/app.py

@ -77,8 +77,8 @@ async def connect(sid, environ):
@sio.event
def disconnect(sid):
print('Client disconnected')
def disconnect(sid, reason):
print('Client disconnected, reason:', reason)
app.static('/static', './static')

4
examples/server/sanic/fiddle.py

@ -21,8 +21,8 @@ async def connect(sid, environ, auth):
@sio.event
def disconnect(sid):
print('disconnected', sid)
def disconnect(sid, reason):
print('disconnected', sid, reason)
app.static('/static', './static')

4
examples/server/tornado/app.py

@ -75,8 +75,8 @@ async def connect(sid, environ):
@sio.event
def disconnect(sid):
print('Client disconnected')
def disconnect(sid, reason):
print('Client disconnected, reason:', reason)
def main():

4
examples/server/tornado/fiddle.py

@ -24,8 +24,8 @@ async def connect(sid, environ, auth):
@sio.event
def disconnect(sid):
print('disconnected', sid)
def disconnect(sid, reason):
print('disconnected', sid, reason)
def main():

4
examples/server/tornado/templates/app.html

@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
socket.on('disconnect', function() {
$('#log').append('<br>Disconnected');
socket.on('disconnect', function(reason) {
$('#log').append('<br>Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('<br>Received: ' + msg.data);

4
examples/server/wsgi/app.py

@ -94,8 +94,8 @@ def connect(sid, environ):
@sio.event
def disconnect(sid):
print('Client disconnected')
def disconnect(sid, reason):
print('Client disconnected, reason:', reason)
if __name__ == '__main__':

4
examples/server/wsgi/django_socketio/socketio_app/static/index.html

@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
socket.on('disconnect', function() {
$('#log').append('<br>Disconnected');
socket.on('disconnect', function(reason) {
$('#log').append('<br>Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('<br>Received: ' + msg.data);

4
examples/server/wsgi/django_socketio/socketio_app/views.py

@ -78,5 +78,5 @@ def connect(sid, environ):
@sio.event
def disconnect(sid):
print('Client disconnected')
def disconnect(sid, reason):
print('Client disconnected, reason:', reason)

4
examples/server/wsgi/fiddle.py

@ -23,8 +23,8 @@ def connect(sid, environ, auth):
@sio.event
def disconnect(sid):
print('disconnected', sid)
def disconnect(sid, reason):
print('disconnected', sid, reason)
if __name__ == '__main__':

4
examples/server/wsgi/templates/index.html

@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
socket.on('disconnect', function() {
$('#log').append('<br>Disconnected');
socket.on('disconnect', function(reason) {
$('#log').append('<br>Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('<br>Received: ' + msg.data);

Loading…
Cancel
Save