How can I make a websocket connection with no ws?

The site initiates a websocket connection but doesn’t use the ws/wss protocol.

https://eu-west-****:9088/web?id=3691&token=aaf0ab69253&heartbeat=1&device_type=4&language=de

That’s because it switches protocols mid-way from HTTP to WS. I didn’t implement a way to do this yet, sometimes you can simply connect to the same socket and it will let you reconnect (after the 101 Switching Protocols response) but other times it will simply block you cause it wants you to reuse the existing TCP connection.

I actually found the WS link in the response body. My problem is, I have tried to connect to it all. It always says it received a 403/404 and was expecting a 101.

You have to first make a normal HTTP request with the Connection: Upgrade header and it will get a 101 Switching Protocols response, THEN and only then you can try to connect via websocket.

Sorry about that. I finally solved it. It was the wrong url after all.

The problem now is, whenever I do WebSocket Read, it’s always empty even though I’m expecting a response.

You need to add a delay block before reading otherwise the server doesn’t have time to reply

Try this may help

1 Like
1 Like

I understand. Thank you very much for the help. I’ve done all that you’ve said but the endpoints that I’m supposed to connect to doesn’t work. I’m not sure why.

Sorry I have no idea, as you can see it works in the example I posted so I think it’s the site blocking you here.