Add support for and use socket host override. (#1682)

* Add support for and use socket host override. Closes #1378

* Fix embeds with the new websocket constructor
This commit is contained in:
Gabe Kangas
2022-03-06 17:11:51 -08:00
committed by GitHub
parent 9d5bdc320c
commit d24ddc2b0a
9 changed files with 75 additions and 82 deletions

View File

@@ -1,4 +1,3 @@
import { URL_WEBSOCKET } from './constants.js';
/**
* These are the types of messages that we can handle with the websocket.
* Mostly used by `websocket.js` but if other components need to handle
@@ -30,8 +29,9 @@ export const CALLBACKS = {
const TIMER_WEBSOCKET_RECONNECT = 5000; // ms
export default class Websocket {
constructor(accessToken) {
constructor(accessToken, path) {
this.websocket = null;
this.path = path;
this.websocketReconnectTimer = null;
this.accessToken = accessToken;
@@ -50,7 +50,7 @@ export default class Websocket {
}
createAndConnect() {
const url = new URL(URL_WEBSOCKET);
const url = new URL(this.path);
url.searchParams.append('accessToken', this.accessToken);
const ws = new WebSocket(url.toString());