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,