Replies: 2 comments
-
If I don't call
This isn't a problem if I monkey patch. |
Beta Was this translation helpful? Give feedback.
0 replies
-
It looks like eventlet's socket implementation doesn't behave exactly like Python's original socket class. I would not recommend removing the monkey patching. Instead you can add a ping_interval, which also indirectly addresses the issue: import eventlet
eventlet.monkey_patch()
import flask
import flask_sock
import eventlet
from eventlet import wsgi
app = flask.Flask(__name__)
app.config['SOCK_SERVER_OPTIONS'] = {'ping_interval': 25}
sock = flask_sock.Sock(app)
@sock.route('/websocket')
def websocket(ws):
ws.close()
if __name__ == '__main__':
wsgi.server(eventlet.listen(("127.0.0.1", 5055)), app) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The code (minimal example that simply closes websocket connections immediately upon creation):
To test a connection:
It gets disconnected (as we expect), but if you run it again a long error is printed in the Python output:
What's the cause of this, and can it be prevented or safely ignored?
flask version: 2.2.3
flask-sock version: 0.6.0
eventlet version: 0.33.3
Beta Was this translation helpful? Give feedback.
All reactions