javascript - NowJS server event notifications -



javascript - NowJS server event notifications -

i'm trying implement scheme external server (superfeedr) sends request server (running node) , server processes, sends info straight client in realtime using nowjs.

problem is, cannot access everyonce namespace in server functions since has initialized after listen() function called has happen after functions declared. basically:

needs:

nowjs->listen->server functions->everyone variable->nowjs

seems have dependency loop , have no thought how resolve it.

start of them independently. when 1 of them up, set reference shared parent scope. when e.g. server receives notification, drop if nowjs isn't ready yet. simplified example:

var a, b; initializea(function(a_) { = a_ a.on('request', function(request, response) { if (!b) { // b isn't ready yet, drop request homecoming response.end() } // ... }) }) initializeb(function(b_) { b = b_ b.on('request', function(request, response) { if (!a) { // isn't ready yet, drop request homecoming response.end() } // ... }) })

javascript node.js real-time nowjs

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -