Where is the cookie stored? Have you enabled CORS?
@Sukh
Have you tried testing on a REST Client??, well if it works, and does not work in a Browser, please check from Firefox Browser.
I had the same issue until I checked from Firefox browser.
As @Anton Tananaev, suggested the problem may lay in CORS.
Cookie is stored in browser @Anton Tananaev
@samaidha I tried with node js and its working but I am receiving return in bytes not json. I haven't tried with REST Client will try that today
Cookie is stored in browser
Genius answer. I obviously know that it's stored in a browser. I was expecting you would provide some proof that will show hosts, so we can validate the CORS theory.
@Sukh
Cookie is stored but still I am getting WebSocket connection to 'ws://85.215.xxx.xx:8082/api/socket' failed:
have you tried adding the Cookie
at your endpoint's header?
If not too much trouble, try without the browser first. Instead please use a CLIENT to check if the socket is working or not :wscat -c ws://85.215.xxx.xx:8082/api/socket --header "Cookie: your-browser-cookie" --auth "username:password"
in the above code snippet I am using wscat ( convenient tool for testing a WebSocket API)
If the your endpoint works in the terminal with "wscat", we can narrow down the problem, I think.
@samaidha
Wscat worked well to test and I can also establish connection with Postman.
Having issues establishing one via Chrome though. Firefox works. Is this is due to Chrome's cookie policy?
Session cookie is the only authorization option for the WebSocket connection
If the issue is CORS, what should web.origin config be set to? Seems default works with Firefox.
Setting web.origin
won't be enough because it doesn't change the cookie samesite settings.
Cookie is stored but still I am getting WebSocket connection to 'ws://85.215.xxx.xx:8082/api/socket' failed: