Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(3)  |  Derive(0)  |  Import(2)

src/f/l/Flask-SocketIO-HEAD/example/app.py   Flask-SocketIO(Download)
from threading import Thread
from flask import Flask, render_template, session, request
from flask.ext.socketio import SocketIO, emit, join_room, leave_room
 
app = Flask(__name__)
def leave(message):
    leave_room(message['room'])
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('my response',
         {'data': 'In rooms: ' + ', '.join(request.namespace.rooms),

src/f/l/Flask-SocketIO-HEAD/test_socketio.py   Flask-SocketIO(Download)
 
from flask import Flask, session
from flask.ext.socketio import SocketIO, send, emit, join_room, leave_room
 
app = Flask(__name__)
def on_leave_room(data):
    leave_room(data['room'])
 
@socketio.on('join room', namespace='/test')
def on_join_room(data):
    join_room(data['room'])
 
@socketio.on('leave room', namespace='/test')
def on_leave_room(data):
    leave_room(data['room'])