mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-30 03:36:44 -06:00
14 lines
491 B
TypeScript
14 lines
491 B
TypeScript
import * as websocket from 'websocket';
|
|
import * as redis from 'redis';
|
|
import { ParsedUrlQuery } from 'querystring';
|
|
|
|
export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient): void {
|
|
const q = request.resourceURL.query as ParsedUrlQuery;
|
|
const channel = q.channel;
|
|
|
|
// Subscribe channel stream
|
|
subscriber.subscribe(`misskey:channel-stream:${channel}`);
|
|
subscriber.on('message', (_, data) => {
|
|
connection.send(data);
|
|
});
|
|
}
|