1

in flask-socketio, is it possible to force the transport to be only web socket?

According to the original protocol:

https://github.com/socketio/engine.io 
transports (<Array> String): transports to allow connections to (['polling', 'websocket'])

My goal would be to get rid of the original HTTP call.

Best,

ptou
  • 323
  • 4
  • 12

2 Answers2

2

See this post - Socket.io 1.x: use WebSockets only?

It looks like you can't get rid of the original HTTP call, but you can tell the client not to use long-polling.

var socket = io({transports: ['websocket']});

I can't find a way to disable it from the server-side with Flask-SocketIO.

Community
  • 1
  • 1
Luke Yeager
  • 1,400
  • 1
  • 17
  • 30
0

According to the documentation of Flask-SoskcetIO you can use async_mode to set async_mode. if you installed eventlet or gevent with gevent-websocket the websocket would be used first.

       async_mode: The asynchronous model to use. See the Deployment
                   section in the documentation for a description of the
                   available options. Valid async modes are
                   ``threading``, ``eventlet``, ``gevent`` and
                   ``gevent_uwsgi``. If this argument is not given,
                   ``eventlet`` is tried first, then ``gevent_uwsgi``,
                   then ``gevent``, and finally ``threading``. The
                   first async mode that has all its dependencies installed
                   is then one that is chosen.
Alfred Zhao
  • 114
  • 1
  • 6