用于将SocketIO服务器添加到Rackio的Rackio扩展
RackioSocket的Python项目详细描述
机架式插座
用于将SocketIO服务器添加到Rackio的Rackio扩展
安装
pip install RackioSocket
使用
^{pr2}$SocketIO客户端
运行应用程序后,它将通过5005端口为SocketIO提供服务。在
varsocket=io('http://localhost:5005');
向应用程序添加新事件
可以使用decorator模式添加自定义事件。在
rs=RackioSocket()@rs.eventdefcustom(sid):print("custom event ",sid)rs.emit("response",{"message":"this is the custom response"})@rs.on("another custom")defanother_event(sid,data):response=processing(data)rs.emit('response',response)
- 项目
标签: