File tree Expand file tree Collapse file tree 1 file changed +24
-12
lines changed
Expand file tree Collapse file tree 1 file changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -90,20 +90,32 @@ def send_message_to_all(self, msg):
9090# ------------------------- Implementation -----------------------------
9191
9292class WebsocketServer (ThreadingMixIn , TCPServer , API ):
93+ """
94+ A websocket server waiting for clients to connect.
95+
96+ Args:
97+ port(int): Port to bind to
98+ host(str): Hostname or IP to listen for connections. By default 127.0.0.1
99+ is being used. To accept connections from any client, you should use
100+ 0.0.0.0.
101+ loglevel: Logging level from logging module to use for logging. By default
102+ warnings and errors are being logged.
103+
104+ Properties:
105+ clients(list): A list of connected clients. A client is a dictionary
106+ like below.
107+ {
108+ 'id' : id,
109+ 'handler' : handler,
110+ 'address' : (addr, port)
111+ }
112+ """
93113
94114 allow_reuse_address = True
95- daemon_threads = True # comment to keep threads alive until finished
96-
97- '''
98- clients is a list of dict:
99- {
100- 'id' : id,
101- 'handler' : handler,
102- 'address' : (addr, port)
103- }
104- '''
105- clients = []
106- id_counter = 0
115+ daemon_threads = True # comment to keep threads alive until finished
116+
117+ clients = []
118+ id_counter = 0
107119
108120 def __init__ (self , port , host = '127.0.0.1' , loglevel = logging .WARNING ):
109121 logger .setLevel (loglevel )
You can’t perform that action at this time.
0 commit comments