Beispiel #1
0
def register_socketio(app):
    socketio.init_app(app)

    # @socketio.on('connect', namespace='/websocket')
    # def test_connect():
    #     emit('server_response', {'data': 'ttt'}, namespace='/websocket')

    @socketio.on('joined', namespace='/websocket')
    def joined(message):
        """Sent by clients when they enter a room.
        A status message is broadcast to all people in the room."""
        emit(
            'message',
            {
                'msg':
                current_user.username + " | " + str(current_user.id) + " | " +
                str(session['space_id'])
            },
        )

    @socketio.on('deploy', namespace='/websocket')
    def test_message(message):
        emit('message', {'msg': message['msg']})
        from walle.service.deployer import DeploySocketIO
        wi = DeploySocketIO(12)
        current_app.logger.info(current_user.id)
        ret = wi.deploy()

    socketio.run(app, host='dev.admin.walle-web.io', port=5000)
Beispiel #2
0
def register_socketio(app):
    if len(sys.argv) > 1 and sys.argv[1] == 'db':
        return app
    socketio.init_app(app, async_mode='gevent')
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socketio.run(app, host=app.config.get('HOST'), port=app.config.get('PORT'))
    return app
Beispiel #3
0
def register_socketio(app):
    if len(sys.argv) > 1 and sys.argv[1] == 'db':
        return app
    socketio.init_app(app, async_mode='gevent')
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socketio.run(app, debug=True, host=app.config.get('HOST'), port=app.config.get('PORT'))
    return app
Beispiel #4
0
def register_socketio(app):
    if len(sys.argv) > 1 and sys.argv[1] == 'db':
        return app
    socketio.init_app(app, async_mode='gevent')
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socket_args = {"debug": app.config.get('DEBUG'), "host": app.config.get('HOST'), "port": app.config.get('PORT')}
    socket_thread = threading.Thread(target=socketio.run, name="socket_thread", args=(app, ), kwargs=socket_args)
    socket_thread.start()
    return app
Beispiel #5
0
def register_socketio(app):
    # activate eventlet
    import eventlet
    eventlet.monkey_patch()

    socketio.init_app(app)
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socketio.run(app, host=app.config.get('HOST'), port=app.config.get('PORT'))
    return app
Beispiel #6
0
def register_socketio(app):
    if len(sys.argv) > 1 and sys.argv[1] == 'db':
        return app
    socketio.init_app(app, async_mode='gevent')
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socket_args = {"debug": app.config.get('DEBUG'), "host": app.config.get('HOST'), "port": app.config.get('PORT')}
    socket_thread = threading.Thread(target=socketio.run, name="socket_thread", args=(app, ), kwargs=socket_args)
    socket_thread.start()
    return app
Beispiel #7
0
def register_socketio(app):
    socketio.init_app(app)
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socketio.run(app, host=app.config.get('HOST'), port=app.config.get('PORT'))
    return app
Beispiel #8
0
def register_socketio(app):
    socketio.init_app(app)
    socketio.on_namespace(WalleSocketIO(namespace='/walle'))
    socketio.run(app, host=app.config.get('HOST'), port=app.config.get('PORT'))
    return app