Skip to content

Commit

Permalink
fix: fix websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
KotRikD committed Mar 27, 2023
1 parent a86a1b8 commit cb80894
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ interface CustomContext extends Koa.Context {
});

const wsRouter = new Router();
wsRouter.use(async (ctx, next) => {
ctx.instancesManager = instancesManager;
await next();
})

wsRouter.get('/ws', async (ctx) => {
wLogger.debug('>>> ws: CONNECTED');
Expand All @@ -101,6 +105,7 @@ interface CustomContext extends Koa.Context {
if (Object.keys(ctx.instancesManager.osuInstances).length < 1) {
ctx.websocket.send('{}');
await sleep(500);
continue;
}

ctx.websocket.send(
Expand Down

0 comments on commit cb80894

Please sign in to comment.