socketio-交换几条消息后未识别连接(?)
我正在运行JS socketio客户端和Python socketio服务器。工作流程大致是客户端发射Event1到服务器
- > 服务器对Event1做出反应,运行分析并发射Event2至Client
- > 客户端再次接收Event2并再次发射Event1,但使用不同的ARGS
- > 等,直到循环完成
问题是,由于某些原因,服务器日志显示出来的某些原因,此工作流程仅适用于两个迭代:
received event "event1" from None [/]
None is not connected to namespace /
received event "event1" from None [/]
None is not connected to namespace /
received event "event1" from None [/]
None is not connected to namespace /
received event "event1" from None [/]
我不知道可能是什么原因。我已经搜索了文档,但似乎找不到任何可能为此负责的参数。
客户:
import { io } from "socket.io-client";
export const socket = io("http://localhost:5550/",
{
timeout: 200000000000
});
socket.emit('event1', args)
socket.on('event2', (msg) => {
...
});
服务器:
app = Flask(__name__)
sio = socketio.Server(logger=True, cors_allowed_origins='*')
app.wsgi_app = socketio.WSGIApp(sio, app.wsgi_app)
if __name__ == '__main__':
server = eventlet.wsgi.server(eventlet.listen(('', 5550)), app)
感谢您提供的任何帮助/提示,谢谢!
I'm running a JS socketio client and a Python socketio server. The workflow is roughly client emitting event1 to server
-> server reacting to event1, running analysis and emitting event2 to client
-> client receives event2 and emits event1 again but with different args
-> etc until loop is complete
The problem is that this workflow only works for two iterations, for some reasons after that the server logs show:
received event "event1" from None [/]
None is not connected to namespace /
received event "event1" from None [/]
None is not connected to namespace /
received event "event1" from None [/]
None is not connected to namespace /
received event "event1" from None [/]
I have no idea whatsoever what might be the reason. I've searched through the docs but can't seem to find any parameters that might be responsible for that.
Client:
import { io } from "socket.io-client";
export const socket = io("http://localhost:5550/",
{
timeout: 200000000000
});
socket.emit('event1', args)
socket.on('event2', (msg) => {
...
});
Server:
app = Flask(__name__)
sio = socketio.Server(logger=True, cors_allowed_origins='*')
app.wsgi_app = socketio.WSGIApp(sio, app.wsgi_app)
if __name__ == '__main__':
server = eventlet.wsgi.server(eventlet.listen(('', 5550)), app)
I appreciate any help/tips you can provide, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论