Pradnya
Pradnya

Reputation: 31

failed: Error during WebSocket handshake: Unexpected response code: 404

I got the error during websocket handshake. Firefox can't establish a connection to the server at ws://localhost:8082/FetchNotification/NewFile.htmlatpendpoint Is there anybody who got the same problem. I have refered the code from https://dzone.com/articles/wso2-products-resolving-err-ssl-weak-ephemeral-dh

Upvotes: 3

Views: 13329

Answers (2)

Guru
Guru

Reputation: 2857

the url you should be using for the function call

Echo.connect("ws://localhost:8082/FetchNotification/NewFile.html")

instead if you are using a variable like Echo.connect("ws://" + host + "/NewFile.html"), please ensure it is /FetchNotification/NewFile.html instead

Otherwise in the websocket Endpoint make sure that the above url is the one you are using for

ServerEndpointConfig.Builder.create(EchoEndpoint.class,"/FetchNotification/Newfile.html").build());

Upvotes: 0

Takahiko Kawasaki
Takahiko Kawasaki

Reputation: 19001

If a request to a WebSocket endpoint is correct, the endpoint returns "101 Switching Protocols". Otherwise, the endpoint will return a normal HTTP response.

You should interpret the 404 error you got as is. That is, the path part of the URL is wrong and it is not found (404 Not Found).

Upvotes: 1

Related Questions