mirror of
https://github.com/MisskeyIO/misskey
synced 2024-12-16 23:58:54 +09:00
refactor
This commit is contained in:
parent
6dc01cd109
commit
deab5bce91
@ -20,7 +20,7 @@ export default class Stream extends EventEmitter {
|
|||||||
private sharedConnections: SharedConnection[] = [];
|
private sharedConnections: SharedConnection[] = [];
|
||||||
private nonSharedConnections: NonSharedConnection[] = [];
|
private nonSharedConnections: NonSharedConnection[] = [];
|
||||||
|
|
||||||
constructor(wsUrl: string, user: { token: string; } | null, options?: {
|
constructor(origin: string, user: { token: string; } | null, options?: {
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -29,7 +29,9 @@ export default class Stream extends EventEmitter {
|
|||||||
_t: Date.now(),
|
_t: Date.now(),
|
||||||
});
|
});
|
||||||
|
|
||||||
this.stream = new ReconnectingWebsocket(`${wsUrl}?${query}`, '', { minReconnectionDelay: 1 }); // https://github.com/pladaria/reconnecting-websocket/issues/91
|
this.stream = new ReconnectingWebsocket(`${origin.replace('http://', 'ws://').replace('https://', 'wss://')}/streaming?${query}`, '', {
|
||||||
|
minReconnectionDelay: 1 // https://github.com/pladaria/reconnecting-websocket/issues/91
|
||||||
|
});
|
||||||
this.stream.addEventListener('open', this.onOpen);
|
this.stream.addEventListener('open', this.onOpen);
|
||||||
this.stream.addEventListener('close', this.onClose);
|
this.stream.addEventListener('close', this.onClose);
|
||||||
this.stream.addEventListener('message', this.onMessage);
|
this.stream.addEventListener('message', this.onMessage);
|
||||||
|
Loading…
Reference in New Issue
Block a user