TakahikoKawasaki / nv-websocket-client

High-quality WebSocket client implementation in Java.
Apache License 2.0
2.03k stars 292 forks source link

403 Forbidden #205

Closed mahditakrim closed 4 years ago

mahditakrim commented 4 years ago

My server works fine with JavaScript and GoLang clients, but when using nv-websocket-client in my android application client I got this error: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.1 403 Forbidden.

I also checked with okhttp and got kinda the same error: Expected HTTP 101 response but was '403 Forbidden' .

Any help will salvage me .

mahditakrim commented 4 years ago

Found it. After hours of reading WebSocket RFC, realized that my GoLang server required 'Origin' field to be in the client's Header.