Daniel Marques commited on
Commit
03ebafe
1 Parent(s): a455f54

fix: add callback

Browse files
Files changed (1) hide show
  1. main.py +5 -4
main.py CHANGED
@@ -246,10 +246,11 @@ async def websocket_endpoint(websocket: WebSocket, client_id: int):
246
 
247
  i = 0
248
  for item in pubsub.listen():
249
- message = item["data"].decode('utf-8')
250
- if(item["type"] == "message") and (message == "end"): pubsub.unsubscribe({client_id})
251
- if(i == 10): pubsub.unsubscribe({client_id})
252
- await websocket.send_text(f'{message}')
 
253
  i+=1
254
 
255
 
 
246
 
247
  i = 0
248
  for item in pubsub.listen():
249
+ if item["type"] == "message":
250
+ message = item["data"].decode('utf-8')
251
+ if message == "end": pubsub.unsubscribe({client_id})
252
+ if(i == 10): pubsub.unsubscribe({client_id})
253
+ await websocket.send_text(f'{message}')
254
  i+=1
255
 
256