Add support for using plugin when MM is served under a subpath (#6403)
This commit is contained in:
parent
41b571f137
commit
5b0b1e9af8
2 changed files with 7 additions and 5 deletions
|
|
@ -44,7 +44,7 @@ export async function newClient(channelID: string, iceServers: ICEServersConfigs
|
|||
console.log('Unable to get media device:', err); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
const ws = new WebSocketClient(Client4.getWebSocketUrl());
|
||||
const ws = new WebSocketClient(Client4.getWebSocketUrl(), Client4.getToken());
|
||||
|
||||
const disconnect = () => {
|
||||
if (!isClosed) {
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ import {encode} from '@msgpack/msgpack/dist';
|
|||
|
||||
export default class WebSocketClient extends EventEmitter {
|
||||
private ws: WebSocket | null;
|
||||
private seqNo = 0;
|
||||
private seqNo = 1;
|
||||
private connID = '';
|
||||
private eventPrefix = `custom_${Calls.PluginId}`;
|
||||
|
||||
constructor(connURL: string) {
|
||||
constructor(connURL: string, authToken: string) {
|
||||
super();
|
||||
this.ws = new WebSocket(connURL);
|
||||
|
||||
this.ws = new WebSocket(connURL, [], {headers: {authorization: `Bearer ${authToken}`}});
|
||||
|
||||
this.ws.onerror = (err) => {
|
||||
this.emit('error', err);
|
||||
|
|
@ -73,6 +74,7 @@ export default class WebSocketClient extends EventEmitter {
|
|||
seq: this.seqNo++,
|
||||
data,
|
||||
};
|
||||
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
if (binary) {
|
||||
this.ws.send(encode(msg));
|
||||
|
|
@ -87,7 +89,7 @@ export default class WebSocketClient extends EventEmitter {
|
|||
this.ws.close();
|
||||
this.ws = null;
|
||||
}
|
||||
this.seqNo = 0;
|
||||
this.seqNo = 1;
|
||||
this.connID = '';
|
||||
this.emit('close');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue