Answer the question
In order to leave comments, you need to log in
How to solve the problem with the visibility of functions?
I found a library for websockets on the Internet . He knows how to launch a websocket server, listen to messages, send, notify about a new connection, disconnection. I wrote an interface over this lib so that decorators can subscribe to a specific channel, room, event. When a message arrives, the registered functions on which the decorator hangs are called and actions are performed there.
Problem: The
WebSocket server is started separately from the runsocketserver.py file by a command that calls the launch from the websocket.py file
def start():
....
cls = Manager
if options['ssl'] == 1:
server = SimpleSSLWebSocketServer(options['host'], options['port'], cls, options['cert'], options['cert'],
version=options['ver'])
else:
server = SimpleWebSocketServer(options['host'], options['port'], cls)
....
@staticmethod
def listen(channel, room, event):
def wrapper(f):
....
@staticmethod
@WebSocketManager.listen('/', 'chat', 'message')
def on_message(packet):
...
class SimpleWebSocketServer(object):
def __init__(self, host, port, websocketclass, selectInterval=0.1):
...
from Websocket.manager import WebSocketManager
from Test.test import Chat
INSTALLED_MODULES = [
Chat
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question