diff --git a/examples/HelloWorld.js b/examples/HelloWorld.js index f13e3a0..5867b82 100644 --- a/examples/HelloWorld.js +++ b/examples/HelloWorld.js @@ -1,7 +1,9 @@ /* The stand-alone runtime has uWS namespace already loaded. */ var uWS = uWS ? uWS : require('../dist/uws.js'); -const port = 3000; +const port = 9001; + +// nice milestone to pass autobahn on both ssl and non-ssl with an without compression const app = uWS./*SSL*/App({ key_file_name: '/home/alexhultman/key.pem', @@ -13,8 +15,8 @@ const app = uWS./*SSL*/App({ open: (ws, req) => { console.log(ws); }, - message: (ws, message) => { - ws.send(message); + message: (ws, message, opCode) => { + ws.send(message, opCode); // need op to pass autobahn (guess binary on off is enough?) } }).listen(port, (token) => { if (token) { @@ -23,6 +25,3 @@ const app = uWS./*SSL*/App({ console.log('Failed to listen to port ' + port); } }); - -/* This is not true for stand-alone */ -console.log('Timers will not work until us_loop_integrate is done'); diff --git a/src/addon.cpp b/src/addon.cpp index e570c7a..c668ff9 100644 --- a/src/addon.cpp +++ b/src/addon.cpp @@ -312,6 +312,9 @@ void Main(Local exports) { emptyNextTickQueue(isolate); }); + /* Hook up our timers */ + us_loop_integrate((us_loop *) uWS::Loop::defaultLoop()); + /*reqTemplateLocal->PrototypeTemplate()->SetAccessor(String::NewFromUtf8(isolate, "url"), Request::url); reqTemplateLocal->PrototypeTemplate()->SetAccessor(String::NewFromUtf8(isolate, "method"), Request::method);*/ diff --git a/uWebSockets b/uWebSockets index c0af883..46537f6 160000 --- a/uWebSockets +++ b/uWebSockets @@ -1 +1 @@ -Subproject commit c0af883bf9517670d7b729b23baeb5346766ed45 +Subproject commit 46537f6f2d500bc611e5dc6bb78a7a5da3baea01