I've recently been hip deep working on a chatroom on my site @
http://luvluvluv.info. I wouldn't call it "simple", but I do use socket.io
and I can testify it is da bomb. My site is supposed to be an in-browser
OSX kind of thing. It's all javascript... client and server. No markup,
no css, just one big blob of a <script> file (well, two if you count
<script src="/socket.io/socket.io.js">!) It's kinda hard to explain... you
just need to see it (with a Chrome browser, of course).
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en