2018-03-07 17:48:32 +09:00
|
|
|
import Stream from './stream';
|
|
|
|
import StreamManager from './stream-manager';
|
2018-04-29 21:37:51 +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-04-08 03:58:11 +09:00
|
|
|
i: me.token
|
2018-03-07 17:48:32 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|