WebSocket handshake error: unexpected response code

I get this error when the project has been deployed to my client server.

WebSocket connection with 'ws: // webserver: 8080 / Project / notificationendpoint' failed: WebSocket handshake error: Unexpected response code: 404

There is no problem running code on 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 the server endpoint:

@ServerEndpoint(value = "/notificationendpoint",
    encoders = {NotifyEncoder.class},
    decoders = {NotifyDecoder.class})
public class Notification {
......
}
+4
source share

All Articles