fix protocol in client JumpStom instance
This commit is contained in:
parent
c9070bb056
commit
ba989bd7f8
@ -19,8 +19,10 @@
|
|||||||
const game = new Game();
|
const game = new Game();
|
||||||
const jumpStorm = new JumpStorm(game);
|
const jumpStorm = new JumpStorm(game);
|
||||||
|
|
||||||
await jumpStorm.init(ctx, "http", "ws", document.location.host + "/api");
|
const { protocol, host } = document.location;
|
||||||
jumpStorm.play();
|
const isHttps = protocol.startsWith('https');
|
||||||
|
jumpStorm.init(ctx, isHttps ? 'https' : 'http', isHttps ? 'wss' : 'ws', `${host}/api`)
|
||||||
|
.then(() => jumpStorm.play());
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user