summaryrefslogtreecommitdiff
path: root/src/server/api/stream/othello.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-17 08:10:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-17 08:10:54 +0900
commit1ef66c962a1cea81dee4f5db32cd011feac7de44 (patch)
tree006945b7ae9d437cebb0fabc5eb5a849cff518c5 /src/server/api/stream/othello.ts
parentAdd missing semicolon (diff)
downloadsharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.tar.gz
sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.tar.bz2
sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.zip
reversi :white_flower: :100:
Diffstat (limited to 'src/server/api/stream/othello.ts')
-rw-r--r--src/server/api/stream/othello.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/server/api/stream/othello.ts b/src/server/api/stream/othello.ts
deleted file mode 100644
index fa62b05836..0000000000
--- a/src/server/api/stream/othello.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as mongo from 'mongodb';
-import * as websocket from 'websocket';
-import * as redis from 'redis';
-import Matching, { pack } from '../../../models/othello-matching';
-import publishUserStream from '../../../publishers/stream';
-
-export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void {
- // Subscribe othello stream
- subscriber.subscribe(`misskey:othello-stream:${user._id}`);
- subscriber.on('message', (_, data) => {
- connection.send(data);
- });
-
- connection.on('message', async (data) => {
- const msg = JSON.parse(data.utf8Data);
-
- switch (msg.type) {
- case 'ping':
- if (msg.id == null) return;
- const matching = await Matching.findOne({
- parentId: user._id,
- childId: new mongo.ObjectID(msg.id)
- });
- if (matching == null) return;
- publishUserStream(matching.childId, 'othello_invited', await pack(matching, matching.childId));
- break;
- }
- });
-}