summaryrefslogtreecommitdiff
path: root/src/client/scripts/stream.ts
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2020-10-09 14:20:34 +0900
committerGitHub <noreply@github.com>2020-10-09 14:20:34 +0900
commit00a17ed5d4ee7f3720dcb5e5b8c8804be3dcb23b (patch)
tree9321b3e284d3f78bdd68c3af32bbbfa2dace1195 /src/client/scripts/stream.ts
parentUpdate resolutions (#6723) (diff)
downloadsharkey-00a17ed5d4ee7f3720dcb5e5b8c8804be3dcb23b.tar.gz
sharkey-00a17ed5d4ee7f3720dcb5e5b8c8804be3dcb23b.tar.bz2
sharkey-00a17ed5d4ee7f3720dcb5e5b8c8804be3dcb23b.zip
/streamingに非WebSocketリクエストが来るとおかしくなるのを修正 Fix #6718 (#6719)
Diffstat (limited to 'src/client/scripts/stream.ts')
-rw-r--r--src/client/scripts/stream.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/scripts/stream.ts b/src/client/scripts/stream.ts
index 8a525ba002..defb22af8e 100644
--- a/src/client/scripts/stream.ts
+++ b/src/client/scripts/stream.ts
@@ -3,6 +3,7 @@ import { EventEmitter } from 'eventemitter3';
import ReconnectingWebsocket from 'reconnecting-websocket';
import { wsUrl } from '../config';
import MiOS from '../mios';
+import { query as urlQuery } from '../../prelude/url';
/**
* Misskey stream connection
@@ -21,7 +22,12 @@ export default class Stream extends EventEmitter {
const user = os.store.state.i;
- this.stream = new ReconnectingWebsocket(wsUrl + (user ? `?i=${user.token}` : ''), '', { minReconnectionDelay: 1 }); // https://github.com/pladaria/reconnecting-websocket/issues/91
+ const query = urlQuery({
+ i: user?.token,
+ _t: Date.now(),
+ });
+
+ this.stream = new ReconnectingWebsocket(`${wsUrl}?${query}`, '', { minReconnectionDelay: 1 }); // https://github.com/pladaria/reconnecting-websocket/issues/91
this.stream.addEventListener('open', this.onOpen);
this.stream.addEventListener('close', this.onClose);
this.stream.addEventListener('message', this.onMessage);