简体   繁体   English

服务器发送的消息未在客户端接收

[英]Message sent by server are not receiving on the client side

The message coming from one client is coming to the Java server. 来自一个客户端的消息正在到达Java服务器。 When a server sends this message to the another client, server showing "message sent" but that message is not received by the client in ws.onmessage block. 当服务器将此消息发送到另一个客户端时,服务器显示“已发送消息”,但客户端在ws.onmessage块中未接收到该消息。

 var ws = new WebSocket("ws://localhost:8080/sampleWebsocket//serverendpointdemo/client1"); ws.onmessage = function(event) { alert("msg"); var str = event.data; } 

Thank you all for response to my question. 谢谢大家回答我的问题。 The actual problem was because of my Redhat cloud. 实际的问题是由于我的Redhat云。 Cloud server was very slow that is why this problem came. 云服务器非常慢,这就是为什么出现此问题的原因。 When I tried to restart my server, that data was coming properly on my ws.onmessage block. 当我尝试重新启动服务器时,该数据已正确放入ws.onmessage块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM