mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 22:49:24 +09:00
fix connection close logic
This commit is contained in:
parent
1d17516aa8
commit
091ef2e240
@ -8,7 +8,7 @@
|
|||||||
"build": "npm run tsc",
|
"build": "npm run tsc",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"tsd": "tsd",
|
"tsd": "tsd",
|
||||||
"jest": "jest",
|
"jest": "jest --detectOpenHandles",
|
||||||
"test": "npm run jest && npm run tsd"
|
"test": "npm run jest && npm run tsd"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -255,8 +255,7 @@ export default class Stream extends EventEmitter<StreamEvents> {
|
|||||||
*/
|
*/
|
||||||
@autobind
|
@autobind
|
||||||
public close() {
|
public close() {
|
||||||
this.stream.removeEventListener('open', this.onOpen);
|
this.stream.close();
|
||||||
this.stream.removeEventListener('message', this.onMessage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,14 @@ describe('Streaming', () => {
|
|||||||
id: 'foo'
|
id: 'foo'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
stream.close();
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* TODO
|
||||||
test('useChannel with parameters', async () => {
|
test('useChannel with parameters', async () => {
|
||||||
// TODO
|
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
test('Connection#dispose', async () => {
|
test('Connection#dispose', async () => {
|
||||||
const server = new WS('wss://misskey.test/streaming');
|
const server = new WS('wss://misskey.test/streaming');
|
||||||
@ -68,6 +70,7 @@ describe('Streaming', () => {
|
|||||||
|
|
||||||
expect(mainChannelReceived.length).toEqual(0);
|
expect(mainChannelReceived.length).toEqual(0);
|
||||||
|
|
||||||
|
stream.close();
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user