robtaussig / react-use-websocket

React Hook for WebSocket communication
MIT License
1.62k stars 135 forks source link

How to use it when I use the HTTP protocol #214

Open Engimaz opened 1 year ago

Engimaz commented 1 year ago

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.

KhalfaniW commented 11 months ago

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

hitecSmartHome commented 2 months ago

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