Skip to content

Instantly share code, notes, and snippets.

@amckinley
Created September 2, 2016 19:54
Show Gist options
  • Save amckinley/41aaaa72fcb2537413d0242a77bf9e1d to your computer and use it in GitHub Desktop.
Save amckinley/41aaaa72fcb2537413d0242a77bf9e1d to your computer and use it in GitHub Desktop.
from flask import Flask
from flask_socketio import SocketIO
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@socketio.on('test')
def handle_message(message):
print('received test: ' + message)
@socketio.on('connect')
def test_connect():
print('got a connect')
socketio.emit('my response', {'data': 'Connected'})
if __name__ == '__main__':
socketio.run(app, port=3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment