problem description
example: get the return value in time after sending the login request, and then handle the next event according to the return value, similar to the http request, but the requirement is to do this with websocket.
in the introduction to websocket, we can fully realize that all callback functions of websocket are executed asynchronously, that is, after I send send (msg), I read the information in onmessage (), which obviously does not meet our requirements.
I want this effect
ws.send("",(res)=>{
//ressendresponse
})