Open DOLLook opened 2 months ago
May be there is no need to use the param mustWaitOnlyTheNextMessage in ask() method. then the ask() method will always use the main loop to read response for the ask() and send the response by channel. finally the ask() can received the response synchronized.
The ask in conn.go line 941. when server send msg to the client. it start a goroutine and runs c.Socket().ReadData(c.readTimeout) to read the next msg. But how it guarantee the next msg is the response that the ask method send? On the other hand, when websocket connected, the server runs startReader() that runs c.Socket().ReadData(c.readTimeout) in loop. In multi goroutine that may be run at the same time. Is it safe to read and how to guarantee the ask() method's response is matchs the ask()?