mirror of
https://github.com/paricafe/misskey.git
synced 2024-12-03 13:26:44 -06:00
19 lines
403 B
TypeScript
19 lines
403 B
TypeScript
import * as websocket from 'websocket';
|
|
import Xev from 'xev';
|
|
|
|
const ev = new Xev();
|
|
|
|
export default function(request: websocket.request, connection: websocket.connection): void {
|
|
const onStats = stats => {
|
|
connection.send(JSON.stringify({
|
|
type: 'stats',
|
|
body: stats
|
|
}));
|
|
};
|
|
|
|
ev.addListener('stats', onStats);
|
|
|
|
connection.on('close', () => {
|
|
ev.removeListener('stats', onStats);
|
|
});
|
|
}
|