[英]connecting to a regular socket server from a web socket server (autobahn)
i am writing an intermediary web socket server so that it can forward messages directly to my existing socket server. 我正在编写一个中间Web套接字服务器,以便它可以将消息直接转发到我现有的套接字服务器。
what i am naively thinking is that on the 我天真地想的是
def onOpen(self):
#initialize socket client and run in a while true loop
i can setup the socket client there and listen forever with a while true
, and do self.sendMessage(...)
for any recv()
data received from the socket client back to the websocket client. 我可以在那里设置套接字客户端,并使用
while true
永久监听,并对从套接字客户端返回到websocket客户端的任何recv()
数据进行self.sendMessage(...)
。
would something like this work? 这样的事情会工作吗? are there better ways to do this?
有更好的方法可以做到这一点吗? what i am worried about is that the
while true
will be blocking for everyone. 我担心的是,尽管如此,对每个人来说都是
while true
。
thanks. 谢谢。
AutobahnPython具有内置功能。 通过 WebSocket包装任何现有的基于流的协议(例如VNC,SSH,IRC,IMAP等) ,请参见此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.