Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Websocket server not async?
Hello ,
I have a wroking websocket server that my application connected to him and send data to the server.
my problem is that sometime the APP send 5-6 messages , while my code didn't finish the first request yet.
so I can see it "running over" and make a lot of mess :-)
is there any way to tell him to wait until finish , then read the next one?
I don't mind him to ignore the messges until he finsih

this is what I have
async def hello(websocket, path):
    global OldClientRespone
    print("--------------------------->" + OldClientRespone)
    ClientResponse = await websocket.recv()
    print ("OLD is - " + OldClientRespone+ "\r\nNew is  " + ClientResponse)
    ## some code that take about 5 seconds to be finish

start_server = websockets.serve(hello, '', 1234)



Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  define a variable before looped websocket korenron 0 368 Sep-22-2019, 12:53 PM
Last Post: korenron
  Async socket server and ports Pengwyn 1 1,244 Feb-28-2019, 12:13 AM
Last Post: DeaD_EyE
  need to understand better, websocket-client, packaging penright 0 1,034 Jul-08-2018, 09:40 PM
Last Post: penright
  Pro's and Con's of some different websocket libraries penright 0 769 Jun-29-2018, 12:07 PM
Last Post: penright

Forum Jump:

Users browsing this thread: 1 Guest(s)