INNER CODE UNIT · Python
on_websocket
dusty-nv/jetson-containers · packages/llm/local_llm/web/server.py:246
def on_websocket(self, websocket):
self.websocket = websocket # TODO handle multiple clients
remote_address = websocket.remote_address
logging.info(f"new websocket connection from {remote_address}")
'''
# empty the queue from before the connection was made
# (otherwise client will be flooded with old messages)
# TODO implement self.connected so the ws_queue doesn't grow so large without webclient connected...
while True:
try:
self.ws_queue.get(block=False)
except queue.Empty:
break
'''
if self.msg_callback: