Skip to content

Commit c25fdfc

Browse files
fix: disable timeout due to nodejs bug
1 parent a7b3979 commit c25fdfc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,21 @@ app.use(async (ctx) => {
8282
console.log(err);
8383
break;
8484
default:
85-
console.error('Unexpected error:')
85+
console.error('Unexpected error:');
8686
console.error(err);
8787
break;
8888
}
89-
})
89+
});
9090
db.listen(ws, { docId, readOnly }); // docId and readOnly is passed to 'connect' middleware as ctx.req
9191
} else {
9292
ctx.body = { docId, readOnly };
9393
}
9494
});
9595

96-
app.listen(process.env.PORT || 8080);
96+
const server = app.listen(process.env.PORT || 8080);
97+
// Reference: https://github.com/b3nsn0w/koa-easy-ws/issues/36
98+
server.requestTimeout = 0;
99+
server.headersTimeout = 0;
97100

98101
function getSessionDetails(sessionId) {
99102
const sessionDetails = documents.get(sessionId);

0 commit comments

Comments
 (0)