Merge pull request #10 from sorrelbri/sj-namespace-socket

init namespace socket
This commit is contained in:
sorrelbri 2019-10-09 10:03:32 -07:00 committed by GitHub
commit 078bbec462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,12 +9,12 @@ def handle_connection():
cool cool
''') ''')
emit('message', {'data':'connection'}) emit('message', {'data':'connection'}, broadcast=True)
@socketio.on('message') @socketio.on('message')
def handle_message(message): def handle_message(message):
print(message) print(message)
emit('message return', {'message':'a message was sent'}, broadcast=True) emit('init namespace', {'namespace':'newroom'})
@socketio.on('connect', namespace='/newroom') @socketio.on('connect', namespace='/newroom')
def handle_connection(): def handle_connection():