dash-extensions
dash-extensions copied to clipboard
Hope to configure WebSocket URL based on server URL
URL property of Websocket is used in browser. I hope there is a way to set the URL based on server-url.
More specifically, I hope that at least the following are taken into account:
-
location.host -
location.hostnameto have a websocket server in other port -
location.protocolto distinguish betweenwssandws
src/lib/components/WebSocket.react.js
url = url? url : "ws://" + location.host + location.pathname + "ws";
this.client = new WebSocket(url, protocols);