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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user