mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-20 03:59:36 +02:00
Fixed bug related to websocket protocol which was making app unusable with reverse proxy and https
This commit is contained in:
parent
f5f735372a
commit
66cc59c48e
4 changed files with 9 additions and 53 deletions
|
@ -50,11 +50,9 @@ const WeatherWidget = (): JSX.Element => {
|
|||
|
||||
// Open socket for data updates
|
||||
useEffect(() => {
|
||||
const webSocketClient = new WebSocket(`ws://${window.location.host}/socket`);
|
||||
|
||||
webSocketClient.onopen = () => {
|
||||
console.log('Socket: listen')
|
||||
}
|
||||
const socketProtocol = document.location.protocol === 'http:' ? 'ws:' : 'wss:';
|
||||
const socketAddress = `${socketProtocol}//${window.location.host}/socket`;
|
||||
const webSocketClient = new WebSocket(socketAddress);
|
||||
|
||||
webSocketClient.onmessage = (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue