summaryrefslogtreecommitdiff
path: root/src/server/api/stream/index.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2020-04-02 22:17:17 +0900
committersyuilo <syuilotan@yahoo.co.jp>2020-04-02 22:17:17 +0900
commit9e9d378bf1301d4c3fcde08543be1014c71a87cd (patch)
treea902b1d1fbec9062046ea1049d74ebf430c65f32 /src/server/api/stream/index.ts
parentUpdate api.ja-JP.md (diff)
downloadsharkey-9e9d378bf1301d4c3fcde08543be1014c71a87cd.tar.gz
sharkey-9e9d378bf1301d4c3fcde08543be1014c71a87cd.tar.bz2
sharkey-9e9d378bf1301d4c3fcde08543be1014c71a87cd.zip
feat(streaming): Add emoji added event
Diffstat (limited to 'src/server/api/stream/index.ts')
-rw-r--r--src/server/api/stream/index.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts
index 2781d14bd9..b7cefcf5ab 100644
--- a/src/server/api/stream/index.ts
+++ b/src/server/api/stream/index.ts
@@ -39,6 +39,10 @@ export default class Connection {
this.wsConnection.on('message', this.onWsConnectionMessage);
+ this.subscriber.on('broadcast', async ({ type, body }) => {
+ this.onBroadcastMessage(type, body);
+ });
+
if (this.user) {
this.updateFollowing();
this.followingClock = setInterval(this.updateFollowing, 5000);
@@ -72,6 +76,11 @@ export default class Connection {
}
}
+ @autobind
+ private onBroadcastMessage(type: string, body: any) {
+ this.sendMessageToWs(type, body);
+ }
+
/**
* APIリクエスト要求時
*/