mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 14:53:09 +02:00
12 lines
413 B
TypeScript
12 lines
413 B
TypeScript
import * as websocket from 'websocket';
|
|
import * as redis from 'redis';
|
|
|
|
export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient): void {
|
|
const channel = request.resourceURL.query.channel;
|
|
|
|
// Subscribe channel stream
|
|
subscriber.subscribe(`misskey:channel-stream:${channel}`);
|
|
subscriber.on('message', (_, data) => {
|
|
connection.send(data);
|
|
});
|
|
}
|