react-use-websocket icon indicating copy to clipboard operation
react-use-websocket copied to clipboard

How to use it when I use the HTTP protocol

Open Engimaz opened this issue 2 years ago • 2 comments

It seems that he only supports WS or WSS but I use the Gateway service, I use the HTTP protocol, and he can forward my WebSocket requests, so how can I use such a good component.

Engimaz avatar Oct 26 '23 13:10 Engimaz

I this is a problem with Websocket protocol not just this library

var webSocket2 = new WebSocket('http://localhost:9000/websocket-proxy');

VM335:1 Uncaught DOMException: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.
    at <anonymous>:1:18


KhalfaniW avatar Dec 03 '23 17:12 KhalfaniW

Strange. I can initiate a connection with http with a regular js websocket client.

hitecSmartHome avatar Sep 10 '24 11:09 hitecSmartHome