forked from mirror/misskey
wip
This commit is contained in:
parent
0616d29fd5
commit
3972e98f74
14
src/server/api/stream/user-list.ts
Normal file
14
src/server/api/stream/user-list.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
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, user: any): void {
|
||||||
|
const q = request.resourceURL.query as ParsedUrlQuery;
|
||||||
|
const listId = q.listId as string;
|
||||||
|
|
||||||
|
// Subscribe stream
|
||||||
|
subscriber.subscribe(`misskey:user-list-stream:${listId}`);
|
||||||
|
subscriber.on('message', (_, data) => {
|
||||||
|
connection.send(data);
|
||||||
|
});
|
||||||
|
}
|
@ -6,6 +6,7 @@ import config from '../../config';
|
|||||||
import homeStream from './stream/home';
|
import homeStream from './stream/home';
|
||||||
import localTimelineStream from './stream/local-timeline';
|
import localTimelineStream from './stream/local-timeline';
|
||||||
import globalTimelineStream from './stream/global-timeline';
|
import globalTimelineStream from './stream/global-timeline';
|
||||||
|
import userListStream from './stream/user-list';
|
||||||
import driveStream from './stream/drive';
|
import driveStream from './stream/drive';
|
||||||
import messagingStream from './stream/messaging';
|
import messagingStream from './stream/messaging';
|
||||||
import messagingIndexStream from './stream/messaging-index';
|
import messagingIndexStream from './stream/messaging-index';
|
||||||
@ -70,6 +71,7 @@ module.exports = (server: http.Server) => {
|
|||||||
request.resourceURL.pathname === '/' ? homeStream :
|
request.resourceURL.pathname === '/' ? homeStream :
|
||||||
request.resourceURL.pathname === '/local-timeline' ? localTimelineStream :
|
request.resourceURL.pathname === '/local-timeline' ? localTimelineStream :
|
||||||
request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream :
|
request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream :
|
||||||
|
request.resourceURL.pathname === '/user-list' ? userListStream :
|
||||||
request.resourceURL.pathname === '/drive' ? driveStream :
|
request.resourceURL.pathname === '/drive' ? driveStream :
|
||||||
request.resourceURL.pathname === '/messaging' ? messagingStream :
|
request.resourceURL.pathname === '/messaging' ? messagingStream :
|
||||||
request.resourceURL.pathname === '/messaging-index' ? messagingIndexStream :
|
request.resourceURL.pathname === '/messaging-index' ? messagingIndexStream :
|
||||||
|
Loading…
Reference in New Issue
Block a user