5

I am getting this error when project was deployed in my clients server.

WebSocket connection to 'ws://webserver:8080/Project/notificationendpoint' failed: Error during WebSocket handshake: Unexpected response code: 404

There is no problem running the code in my system. We both use Ubuntu 14.04.(32 bit). My chrome version: 47.0.2526.106. Client version: 48.0.2564.109

This is how i get the host location in js:

var wsUri = "ws://" + document.location.host + "/Project/notificationendpoint";
var websocket = new WebSocket(wsUri);

It connects to Server Endpoint:

@ServerEndpoint(value = "/notificationendpoint",
    encoders = {NotifyEncoder.class},
    decoders = {NotifyDecoder.class})
public class Notification {
......
}
Sanal S
  • 1,105
  • 14
  • 27
  • Well 404 is Not found ... double-check your endpoint and also make sure it is accessible from outside. I am always using `window.location.host` but I guess using `document` should be fine in your case... – Anton Sarov Apr 12 '16 at 08:17

0 Answers0