How to subscribe to Slash GraphQL in the correct way, getting 301 error

So I have been trying to subscribe to Slash GraphQL, but I am getting a 301 error:

WebSocket connection to ‘ws://******’ failed: Error during WebSocket handshake: Unexpected response code: 301

I am using Apollo client along with all the subscription-related config done, please note that the first time when the subscription gets initialized, all the data I am getting is perfect, but after that, all my WS requests are responding with a status code of 301. Any help would be highly appreciated. Thanks.

can you follow this tutorial to setup subscription and check if your problem still exists ?

@mbj36 Thanks for the help, I figured out from the example that I have to use the “wss://” protocol instead of “ws://”, I changed the same and now it is working perfectly. Thanks again.

1 Like