From aad717ba9315ad492121f32b62ae6e2388cc2f2d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20T=C3=A9tard?= Date: Thu, 19 Nov 2015 14:34:28 +0100 Subject: [PATCH] =?utf8?q?D=C3=A9sactivation=20de=20SocketIO=20pour=20l?= =?utf8?q?=E2=80=99instant?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- femtoblackweb.py | 80 +----------------------------------------------- requirements.txt | 2 -- 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/femtoblackweb.py b/femtoblackweb.py index 14d556e..52223b5 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -8,8 +8,6 @@ from werkzeug import secure_filename from datetime import datetime -from flask.ext.socketio import SocketIO, emit, join_room, leave_room, close_room, rooms, disconnect - from flask_bootstrap import Bootstrap import json @@ -32,7 +30,6 @@ app.config.update({ app.config.from_envvar('FEMTOBLACK_SETTINGS', silent=True) Bootstrap(app) -socketio = SocketIO(app) @app.errorhandler(404) def page_not_found(e): @@ -118,81 +115,6 @@ def analyze_file(filename): else: abort(404) -@app.route('/testio') -def testio(): - return render_template('testio.html') - - -@socketio.on('my event', namespace='/test') -def test_message(message): - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', - {'data': message['data'], 'count': session['receive_count']}) - - -@socketio.on('my broadcast event', namespace='/test') -def test_broadcast_message(message): - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', - {'data': message['data'], 'count': session['receive_count']}, - broadcast=True) - - -@socketio.on('join', namespace='/test') -def join(message): - join_room(message['room']) - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', - {'data': 'In rooms: ' + ', '.join(rooms()), - 'count': session['receive_count']}) - - -@socketio.on('leave', namespace='/test') -def leave(message): - leave_room(message['room']) - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', - {'data': 'In rooms: ' + ', '.join(rooms()), - 'count': session['receive_count']}) - - -@socketio.on('close room', namespace='/test') -def close(message): - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', {'data': 'Room ' + message['room'] + ' is closing.', - 'count': session['receive_count']}, - room=message['room']) - close_room(message['room']) - - -@socketio.on('my room event', namespace='/test') -def send_room_message(message): - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', - {'data': message['data'], 'count': session['receive_count']}, - room=message['room']) - - -@socketio.on('disconnect request', namespace='/test') -def disconnect_request(): - session['receive_count'] = session.get('receive_count', 0) + 1 - emit('my response', - {'data': 'Disconnected!', 'count': session['receive_count']}) - disconnect() - - -@socketio.on('connect', namespace='/test') -def test_connect(): - emit('my response', {'data': 'Connected', 'count': 0}) - - -@socketio.on('disconnect', namespace='/test') -def test_disconnect(): - print('Client disconnected', request.sid) - - - if __name__ == "__main__": - socketio.run(app) - #app.run(debug=True) + app.run(debug=True) diff --git a/requirements.txt b/requirements.txt index 005711d..c0b4e8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,5 @@ dominate==2.1.16 eventlet==0.17.4 greenlet==0.4.9 itsdangerous==0.24 -python-engineio==0.7.1 -python-socketio==0.6.1 six==1.10.0 visitor==0.1.2 -- 2.30.2