Wrap idleTimeout

This commit is contained in:
Alex Hultman 2019-01-22 18:50:37 +01:00
parent 8da1edc516
commit f2a5d95726
2 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ const app = uWS./*SSL*/App({
/* Options */ /* Options */
compression: 0, compression: 0,
maxPayloadLength: 16 * 1024 * 1024, maxPayloadLength: 16 * 1024 * 1024,
idleTimeout: 10,
/* Handlers */ /* Handlers */
open: (ws, req) => { open: (ws, req) => {
console.log('A WebSocket connected via URL: ' + req.getUrl() + '!'); console.log('A WebSocket connected via URL: ' + req.getUrl() + '!');
@ -25,6 +26,8 @@ const app = uWS./*SSL*/App({
close: (ws, code, message) => { close: (ws, code, message) => {
console.log('WebSocket closed'); console.log('WebSocket closed');
} }
}).any('/*', (res, req) => {
res.end('Nothing to see here!');
}).listen(port, (token) => { }).listen(port, (token) => {
if (token) { if (token) {
console.log('Listening to port ' + port); console.log('Listening to port ' + port);

View File

@ -32,6 +32,9 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
/* maxPayloadLength */ /* maxPayloadLength */
behavior.maxPayloadLength = behaviorObject->Get(String::NewFromUtf8(isolate, "maxPayloadLength"))->Int32Value(); behavior.maxPayloadLength = behaviorObject->Get(String::NewFromUtf8(isolate, "maxPayloadLength"))->Int32Value();
/* idleTimeout */
behavior.idleTimeout = behaviorObject->Get(String::NewFromUtf8(isolate, "idleTimeout"))->Int32Value();
/* Compression, map from 0, 1, 2 to disabled, shared, dedicated */ /* Compression, map from 0, 1, 2 to disabled, shared, dedicated */
int compression = behaviorObject->Get(String::NewFromUtf8(isolate, "compression"))->Int32Value(); int compression = behaviorObject->Get(String::NewFromUtf8(isolate, "compression"))->Int32Value();
if (compression == 0) { if (compression == 0) {