Sharkey/src/server/api/stream/channels/messaging.ts
syuilo d0570d7fe3
V10 (#2826)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update CHANGELOG.md

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update CHANGELOG.md

* Update CHANGELOG.md

* wip

* Update CHANGELOG.md

* wip

* wip

* wip

* wip
2018-10-07 11:06:17 +09:00

26 lines
615 B
TypeScript

import autobind from 'autobind-decorator';
import read from '../../common/read-messaging-message';
import Channel from '../channel';
export default class extends Channel {
private otherpartyId: string;
@autobind
public async init(params: any) {
this.otherpartyId = params.otherparty as string;
// Subscribe messaging stream
this.subscriber.on(`messagingStream:${this.user._id}-${this.otherpartyId}`, data => {
this.send(data);
});
}
@autobind
public onMessage(type: string, body: any) {
switch (type) {
case 'read':
read(this.user._id, this.otherpartyId, body.id);
break;
}
}
}