Work on websockets. Finally 95.5% working?
This commit is contained in:
@@ -615,6 +615,8 @@ async def redis_connector(
|
|||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
# The consumer is receiving WS JSON data
|
# 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):
|
async def consumer_handler(ws_conn: WebSocket, r_conn, client_id, group_id):
|
||||||
log.info('consumer_handler()')
|
log.info('consumer_handler()')
|
||||||
|
|
||||||
@@ -656,6 +658,7 @@ async def redis_connector(
|
|||||||
# r.publish('chat:c', str({'test': 'xxxx'}))
|
# r.publish('chat:c', str({'test': 'xxxx'}))
|
||||||
# r.publish('chat:c', str('data goes here...'))
|
# r.publish('chat:c', str('data goes here...'))
|
||||||
except WebSocketDisconnect as exc:
|
except WebSocketDisconnect as exc:
|
||||||
|
# TODO: This needs handling better?
|
||||||
# FUTURE: Remove from list of connected clients?
|
# FUTURE: Remove from list of connected clients?
|
||||||
log.error(exc)
|
log.error(exc)
|
||||||
await r_conn.close()
|
await r_conn.close()
|
||||||
@@ -668,6 +671,8 @@ async def redis_connector(
|
|||||||
|
|
||||||
# Also called the Redis reader for a channel subscription
|
# Also called the Redis reader for a channel subscription
|
||||||
# This watches a Redis channel. Then sends out the message.
|
# 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):
|
async def producer_handler(r_channel, ws_conn: WebSocket, client_id, group_id):
|
||||||
log.info('producer_handler()')
|
log.info('producer_handler()')
|
||||||
|
|
||||||
@@ -692,12 +697,11 @@ async def redis_connector(
|
|||||||
log.debug('(Reader) STOP')
|
log.debug('(Reader) STOP')
|
||||||
break
|
break
|
||||||
except ConnectionError as conn_e:
|
except ConnectionError as conn_e:
|
||||||
|
# TODO: This needs handling better?
|
||||||
log.error(conn_e)
|
log.error(conn_e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None
|
# raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None
|
||||||
# redis.exceptions.ConnectionError: Connection closed by server.
|
# redis.exceptions.ConnectionError: Connection closed by server.
|
||||||
|
|
||||||
# TODO this needs handling better
|
|
||||||
log.error(e)
|
log.error(e)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user