Add origin to the websocket connection (#208)
* Add origin to the websocket connection * parse the url with a regex
This commit is contained in:
parent
9ca8d5d3ac
commit
45ad4268eb
1 changed files with 4 additions and 1 deletions
|
|
@ -51,7 +51,10 @@ class WebSocketClient {
|
|||
if (this.connectingCallback) {
|
||||
this.connectingCallback(dispatch, getState);
|
||||
}
|
||||
this.conn = new Socket(connectionUrl);
|
||||
|
||||
const captured = (/^(?:https?|wss?):\/\/[^/]*/).exec(connectionUrl);
|
||||
const origin = captured ? captured[0] : null;
|
||||
this.conn = new Socket(connectionUrl, null, {origin});
|
||||
this.connectionUrl = connectionUrl;
|
||||
this.token = token;
|
||||
this.dispatch = dispatch;
|
||||
|
|
|
|||
Loading…
Reference in a new issue