http chat: webrick or roll-my-own webserver?

J

Joe Edelman

I want to build an HTTP-based chat server. The idea is that there
would be one URL to post a message, and another to "listen". This
latter request would never completely finish loading in browsers;
rather, connections would remain open, and posted text would be sent to
all listening browsers. There are existing HTTP chat clients that work
this way.

Webrick, it seems, is too abstract and servlet-oriented to operate well
this way. I need an httpd toolkit at a much lower level -- something
that will let me keep hundreds of connections open on the listen side
while quickly dispatching posts on the other side in the same process
and hopefully in the very same thread. I also need to become aware of
when the listening connections are closed, so that I can update the
chat roster.

Perl's HTTP::Daemon is well designed for this kind of thing. Is there
something similar in ruby-land, or is there someone who knows webrick
guts well enough to say how to misuse it in this way?

Thanks,

--Joe

P.S. Although I've said "chat" above, in reality I'm going to be
passing arbitrary javascript messages around, thus creating a platform
for enabling complex real-time programmatic interaction between all
users of a site.
 
P

Pat Maddox

Have you looked at Ajax? You could use that to take care of the
asynchronous messaging.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top