Hook up timers with us_loop_integrate

This commit is contained in:
Alex Hultman 2018-12-26 19:19:26 +01:00
parent ffb664509c
commit ba90a20e0f
3 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,9 @@
/* The stand-alone runtime has uWS namespace already loaded. */ /* The stand-alone runtime has uWS namespace already loaded. */
var uWS = uWS ? uWS : require('../dist/uws.js'); 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({ const app = uWS./*SSL*/App({
key_file_name: '/home/alexhultman/key.pem', key_file_name: '/home/alexhultman/key.pem',
@ -13,8 +15,8 @@ const app = uWS./*SSL*/App({
open: (ws, req) => { open: (ws, req) => {
console.log(ws); console.log(ws);
}, },
message: (ws, message) => { message: (ws, message, opCode) => {
ws.send(message); ws.send(message, opCode); // need op to pass autobahn (guess binary on off is enough?)
} }
}).listen(port, (token) => { }).listen(port, (token) => {
if (token) { if (token) {
@ -23,6 +25,3 @@ const app = uWS./*SSL*/App({
console.log('Failed to listen to port ' + port); 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');

View File

@ -312,6 +312,9 @@ void Main(Local<Object> exports) {
emptyNextTickQueue(isolate); 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, "url"), Request::url);
reqTemplateLocal->PrototypeTemplate()->SetAccessor(String::NewFromUtf8(isolate, "method"), Request::method);*/ reqTemplateLocal->PrototypeTemplate()->SetAccessor(String::NewFromUtf8(isolate, "method"), Request::method);*/

@ -1 +1 @@
Subproject commit c0af883bf9517670d7b729b23baeb5346766ed45 Subproject commit 46537f6f2d500bc611e5dc6bb78a7a5da3baea01