i am writing an intermediary web socket server so that it can forward messages directly to my existing socket server.
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.
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.
thanks.
AutobahnPython has that built in. Wrap any existing stream-based protocol (such as VNC, SSH, IRC, IMAP, ...) over WebSocket - please see here.