Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[NodeJS] Lexical environment issues filter_list
Author
Message
[NodeJS] Lexical environment issues #1
Code:
router.post('/', function (req, res) {
// Need to send ws.send() with post data
})


wss.on('connection', function(ws) {
  ws.on('message', function(message) {
    console.log('r : %s', message);
  });
  // ws is only define under this callback as an object of type ws
});

ws is only defined within the wss connection event.

ws = WebSockets
router = default Express router

I've read a tiny amount about 'closures', but haven't fully read on them.

Any advice, guys?

Reply

RE: [NodeJS] Lexical environment issues #2
i have no idea about coding really but im geussing anyone that does would need a bit more info
Get Cheap Premium Wordpress Plugins & themes
[Image: cropped-Wordprespluginscheap1.png]
Viralwire Viral Video Website

Reply

RE: [NodeJS] Lexical environment issues #3
(07-20-2015, 11:42 PM)leen12 Wrote: i have no idea about coding really but im geussing anyone that does would need a bit more info

Nope. Used Events to get around it.

Reply







Users browsing this thread: 1 Guest(s)