Detect protocol for websocket
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
824fb9d063
commit
7dc3d8d871
1 changed files with 3 additions and 1 deletions
|
@ -2,7 +2,9 @@ import Sockette from "sockette";
|
|||
import Event from "pubsub-js";
|
||||
|
||||
const host = window.location.host;
|
||||
const Socket = new Sockette("ws://" + host + "/api/v1/ws", {
|
||||
const prot = ('https:' === document.location.protocol ? 'wss://' : 'ws://');
|
||||
|
||||
const Socket = new Sockette(prot + host + "/api/v1/ws", {
|
||||
timeout: 5e3,
|
||||
onopen: e => {
|
||||
console.log('Connected!', e);
|
||||
|
|
Loading…
Reference in a new issue