Omkar008 commited on
Commit
0e83ece
1 Parent(s): 959407d

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +3 -7
test.py CHANGED
@@ -270,16 +270,12 @@ async def test_websocket(websocket: WebSocket):
270
  # less_process.communicate(input=json_str.encode("utf-8"))
271
  if data:
272
  data_new[filename]=str(data[:10])
273
- # data_new.append({filename:data.encode("UTF-8")})
274
- # Decode base64-encodattaed attachment data
275
- # print(filename)s
276
  attachment_content = base64.urlsafe_b64decode(data.encode("UTF-8"))
277
- # print(attachment_content)
278
- print("yo")
279
- # print(data_new)
280
  attachment_no+=1
281
  time.sleep(2)
282
- await websocket.send_json({filename:data})
283
 
284
  # yield f"data: {str(data_new)}\n\n"
285
 
 
270
  # less_process.communicate(input=json_str.encode("utf-8"))
271
  if data:
272
  data_new[filename]=str(data[:10])
 
 
 
273
  attachment_content = base64.urlsafe_b64decode(data.encode("UTF-8"))
274
+ await websocket.send_json({"filename": filename})
275
+ await websocket.send_bytes(attachment_content)
 
276
  attachment_no+=1
277
  time.sleep(2)
278
+ # await websocket.send_json({filename:data})
279
 
280
  # yield f"data: {str(data_new)}\n\n"
281