Here's a tutorial that we wrote that provides step-by-step instructions on 
how to create a chat room with socket.io and Node. Might be helpful.

http://www.switchonthecode.com/tutorials/simple-chat-nodejs-plus-websockets

On Friday, January 4, 2013 6:38:17 PM UTC-5, Josh Santangelo wrote:
>
> I'm trying to build a simple server where multiple clients connect over 
> TCP, and any message from a client is relayed to all the others. This isn't 
> going to be used for a chat room, but it's basically the same idea.
>
> I tried building this with socket.io but got stuck pretty quickly:
>
> var io = require('socket.io').listen(81);
>
> console.log('foo');
> io.sockets.on('connect', function (socket) {
>   console.log('connected...');
>
>   socket.on('disconnect', function () {
>     console.log('disconnected');
>   });
> });
>
> I see "foo" trace out, and on the client side it looks like I'm connected, 
> but "connected" and "disconnected" never trace out, so I'm guessing those 
> event handlers aren't working for some reason.
>
> I'm not married to socket.io, and actually using fewer modules would be 
> better, but I'm surprised I couldn't find a code sample for this use case 
> since it sounds like it's a pretty common node.js usage.
>
> Obviously this is my first time using node.js! Any pointers would be very 
> helpful.
>
> thanks,
> -josh
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to