Work on websockets. Finally 95.5% working?

This commit is contained in:
Scott Idem
2023-04-07 14:09:48 -04:00
parent b1d70323f3
commit eadaf7d69f

View File

@@ -615,6 +615,8 @@ async def redis_connector(
log.debug(locals())
# The consumer is receiving WS JSON data
# ws_receiver_json_handler()
# receiver_handler() # RENAME TO THIS
async def consumer_handler(ws_conn: WebSocket, r_conn, client_id, group_id):
log.info('consumer_handler()')
@@ -656,6 +658,7 @@ async def redis_connector(
# r.publish('chat:c', str({'test': 'xxxx'}))
# r.publish('chat:c', str('data goes here...'))
except WebSocketDisconnect as exc:
# TODO: This needs handling better?
# FUTURE: Remove from list of connected clients?
log.error(exc)
await r_conn.close()
@@ -668,6 +671,8 @@ async def redis_connector(
# Also called the Redis reader for a channel subscription
# This watches a Redis channel. Then sends out the message.
# redis_watcher_ws_sender_json_handler()
# sender_handler() # RENAME TO THIS
async def producer_handler(r_channel, ws_conn: WebSocket, client_id, group_id):
log.info('producer_handler()')
@@ -692,12 +697,11 @@ async def redis_connector(
log.debug('(Reader) STOP')
break
except ConnectionError as conn_e:
# TODO: This needs handling better?
log.error(conn_e)
except Exception as e:
# raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None
# redis.exceptions.ConnectionError: Connection closed by server.
# TODO this needs handling better
log.error(e)