烧瓶射击不处理事件
嗨,我无法处理从Python客户端到Python服务器(Blask socket-io)的Socketio事件。两者都在连接。但是事件不是
关于环境的注释: 我的客户在Hyper V访问者中。我添加了一个虚拟适配器。主机IP是10.10.10.1
服务器:
app = Flask(__name__)
sio = SocketIO(app,logger=True, engineio_logger=True)
sio.run(app,host='10.10.10.1',port=5555)
@sio.on("event")
def ev_handle(data):
emit("NO")
print("printme")
客户端:
sio=socketio.Client(logger=True, engineio_logger=True)
sio.connect("http://10.10.10.1:5555")
while True:
input("say something to emit event\n")
sio.emit("event",data="bob")
客户端输出:
>
到目前为止尝试的解决方案:
- 其他事件名称,在连接上尝试,尝试使用@Sio。事件
- 尝试写入文件,以查看打印是否是问题 我的代码似乎很合理。 idk为什么它不起作用。防火墙似乎不是问题,因为Ping和Pong被发送/接收
Hi i am unable to handle socketio event from a python client to a python server(flask socket-io). Both are connecting. but events are not handled
Notes on environement:
My client is on a Hyper V guest. i added a virtual adapter. host ip is 10.10.10.1
Server:
app = Flask(__name__)
sio = SocketIO(app,logger=True, engineio_logger=True)
sio.run(app,host='10.10.10.1',port=5555)
@sio.on("event")
def ev_handle(data):
emit("NO")
print("printme")
Client:
sio=socketio.Client(logger=True, engineio_logger=True)
sio.connect("http://10.10.10.1:5555")
while True:
input("say something to emit event\n")
sio.emit("event",data="bob")
output for client:
output for server:
tried solution so far:
- different event name, tried on connect , tried to use @sio.event
- tried writing into a file to see if print was the problem
My code seems reasonable. idk why it is not working. firewall does not seem to be the issue as PING and PONG are being sent/received
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人正在寻找修复程序,则需要在致电运行之前实现处理程序:
If anyone is looking for a fix, you need to implement the handlers before you call run: