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

Discussion in 'Ruby' started by Joe Edelman, Apr 2, 2005.

  1. Joe Edelman

    Joe Edelman Guest

    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.
     
    Joe Edelman, Apr 2, 2005
    #1
    1. Advertising

  2. Joe Edelman

    Pat Maddox Guest

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

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


    On Apr 2, 2005 12:54 PM, Joe Edelman <> wrote:
    > 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.
    >
    >
     
    Pat Maddox, Apr 2, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    5
    Views:
    471
  2. Replies:
    0
    Views:
    2,226
  3. Edwin Knoppert

    Creating my own webserver

    Edwin Knoppert, May 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    498
    Edwin Knoppert
    May 10, 2006
  4. Lloyd Zusman
    Replies:
    2
    Views:
    423
  5. Aaron Smith

    WEBrick::Daemon and WEBrick

    Aaron Smith, Mar 9, 2007, in forum: Ruby
    Replies:
    2
    Views:
    328
    Aaron Smith
    Mar 18, 2007
Loading...

Share This Page