sharkey/src/web/app/common/scripts/streaming/messaging-index.ts

35 lines
651 B
TypeScript
Raw Normal View History

2018-03-07 17:48:32 +09:00
import Stream from './stream';
import StreamManager from './stream-manager';
2018-03-15 19:53:46 +09:00
import MiOS from '../../mios';
2018-03-07 17:48:32 +09:00
/**
* Messaging index stream connection
*/
export class MessagingIndexStream extends Stream {
2018-03-15 19:53:46 +09:00
constructor(os: MiOS, me) {
super(os, 'messaging-index', {
2018-03-07 17:48:32 +09:00
i: me.token
});
}
}
export class MessagingIndexStreamManager extends StreamManager<MessagingIndexStream> {
private me;
2018-03-15 19:53:46 +09:00
private os: MiOS;
2018-03-07 17:48:32 +09:00
2018-03-15 19:53:46 +09:00
constructor(os: MiOS, me) {
2018-03-07 17:48:32 +09:00
super();
this.me = me;
2018-03-15 19:53:46 +09:00
this.os = os;
2018-03-07 17:48:32 +09:00
}
public getConnection() {
if (this.connection == null) {
2018-03-15 19:53:46 +09:00
this.connection = new MessagingIndexStream(this.os, this.me);
2018-03-07 17:48:32 +09:00
}
return this.connection;
}
}