Home > front end >  To send data Websocket, onmessage listening is less than the background
To send data Websocket, onmessage listening is less than the background

Time:01-09

I sent via Websocket to monitor the server data, webscoket connected successfully, but don't get the message in the onmessage, and it is part of a computer to receive less than, want to ask next everybody has encountered this kind of situation, here is my code:
ReseveMessage () {
Let that=this
Let wsImpl=window. WebSocket | | window. MozWebSocket
Window. Ws=new wsImpl (enclosing $root. BoardIP)
Ws. Onmessage=function (evt) {
//alert (" received information ")
The console. The log (evt)
Let data=https://bbs.csdn.net/topics/JSON.parse (evt) data)
If (data type==='DP') {
That. NoticeDatas. Push (data)
}
If (that) active_ward) value! .==data receiver) {
Return false
}
}
Ws. Onopen=function () {
The console. The log (' connection open ')
}
Ws. Onclose=function () {
The console. The log (' connection closed ')
SetTimeout (function () {
That. ReseveMessage ()
}, 5000)
}
},

CodePudding user response:

Eldest brother eldest brother, I have encountered this, you don't solve, bother to share, WeChat 15129739599 or you reply your contact information

CodePudding user response:

Are either code has a problem, or concurrent too high,

CodePudding user response:

refer to the second floor Rimifon response:
either code has a problem, either high concurrency,
tests, tests only three devices online at the same time, only the last one can trigger,

CodePudding user response:

There is something wrong with the server code is there

CodePudding user response:

Server has several, if more than one server, may be it is for this reason, each user access server is not the same cause, previously encountered when using the c # Signalr

CodePudding user response:

reference 1/f, peng wang studio response:
eldest brother eldest brother, I have encountered this, you don't solve, bother to share, WeChat 15129739599 or you reply your contact information

See me upstairs
  • Related