Hi
very new in node,,,
I have a program found on web
(https://codesachin.wordpress.com/2015/06/27/redis-node-js-socket-io-event-driven-subscription-based-broadcasting/)
that creates an http server with socket.io and redis for pub/sub
I also have a client for subscribe channels by i cant gueds the request for
publish client:
The web page says that the subscribe cliente is like this:
var io = require('socket.io-client');
var serverUrl = 'http://localhost:3000';
var conn = io.connect(serverUrl);
conn.emit('subscribe', 'somechannel');
conn.on('message', function (message)
{
console.log(message);
conn.emit('unsubscribe', 'somechannel');
}
);
as in server the subscribe is defined like:
/Subscribe request from client
socketconnection.on('subscribe', function(channel_name){
The message (subscriber) is defined like this:
global_channels[channel_name].on('message', function(channel, message)
{
console.log("Message");
Object.keys(global_channels[channel_name].listeners).forEach(function(key)
{
global_channels[channel_name].listeners[key].send(message);
}
);
}
and now i have the client to publish message like this:
var io = require('socket.io-client');
var serverUrl = 'http://localhost:3000';
var conn = io.connect(serverUrl);
conn.emit('message', 'somechannel','Hello');
But the Message event never occous in server. Why? How to call it?
Thanks a lot
Imo
...
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/e5948ca7-8b4c-40ab-8295-1e2664cd13e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.