Thanks to the the Agile Web Development with Rails book and Curt Hibb''s article on the subject, I''m slowly starting to get my head around AJAX, and have been thinking that an ajax chat application is certainly do''able. A quick Google on the subject provides confirmation that the idea is neither hair-brained, nor original :) http://dev.rubyonrails.com/ticket/945 http://www.plasticshore.com/viewEntry.php?id=205 http://brandedthoughts.co.uk/taxonomy/term/33 Alas, I have no clue as to where to get started...I would assume that periodically_call_remote would be at the heart of the app, along with form_remote_tag. I''m very foggy about the mechanics, however, of how the server would go about pumping out the input from a single person to the browsers of others participating in the chat. Would the comments need to be stored, at least temporarily in a db table so that the server could pull them as AR objects? Might anyone point me in the right direction for researching this more, or even better, a working demo of how this might work? Thanks, Howard
On 7/11/05, Lord Khaos <lordkhaos-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> Thanks to the the Agile Web Development with Rails book and Curt Hibb''s > article on the subject, I''m slowly starting to get my head around AJAX, > and have been thinking that an ajax chat application is certainly > do''able. > A quick Google on the subject provides confirmation that the idea is > neither hair-brained, nor original :) > > http://dev.rubyonrails.com/ticket/945 > http://www.plasticshore.com/viewEntry.php?id=205 > http://brandedthoughts.co.uk/taxonomy/term/33 > > Alas, I have no clue as to where to get started...I would assume that > periodically_call_remote would be at the heart of the app, along with > form_remote_tag. I''m very foggy about the mechanics, however, of how the > server would go about pumping out the input from a single person to the > browsers of others participating in the chat. Would the comments need to > be stored, at least temporarily in a db table so that the server could > pull them as AR objects? > > Might anyone point me in the right direction for researching this more, > or even better, a working demo of how this might work?Quek by q42 was the first that I recall: http://q42.nl/products/ (in 2001!). It''s a graphical avatar chat system that sits on a web page. Amazing stuff (as are all of their products). BlogChat is an early simple HTML chat app, dating back to 2002: http://www.ashleyit.com/blogs/brentashley/archives/000295.html I don''t believe it uses XMLHttpRequest, but the idea is the same. It actually uses his Javascript Remote Scripting (JSRS) library to accomplish it. His blog recently pointed to Lace, a newer implementation worth taking a look at: http://socket7.net/lace/ -- rick http://techno-weenie.net
nick-uKEOoZLWRHPYtjvyW6yDsg@public.gmane.org
2005-Jul-11 22:27 UTC
RE: AJAX Chat Script: Thinking out loud
An ajax chat script is certainly very do-able. In fact, there''s a game (www.kingdomofloathing.com) that has an ajax chat which is pretty cool. I''ve been considering writing one for awhile now, and with the awesome ajax support in rails I''m thinking that''s the way I''m going to go.> -------- Original Message -------- > Subject: [Rails] AJAX Chat Script: Thinking out loud > From: Lord Khaos <lordkhaos-Wuw85uim5zDR7s880joybQ@public.gmane.org> > Date: Mon, July 11, 2005 12:58 pm > To: Rails list <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > > Thanks to the the Agile Web Development with Rails book and Curt Hibb''s > article on the subject, I''m slowly starting to get my head around AJAX, > and have been thinking that an ajax chat application is certainly > do''able. > A quick Google on the subject provides confirmation that the idea is > neither hair-brained, nor original :) > > http://dev.rubyonrails.com/ticket/945 > http://www.plasticshore.com/viewEntry.php?id=205 > http://brandedthoughts.co.uk/taxonomy/term/33 > > Alas, I have no clue as to where to get started...I would assume that > periodically_call_remote would be at the heart of the app, along with > form_remote_tag. I''m very foggy about the mechanics, however, of how the > server would go about pumping out the input from a single person to the > browsers of others participating in the chat. Would the comments need to > be stored, at least temporarily in a db table so that the server could > pull them as AR objects? > > Might anyone point me in the right direction for researching this more, > or even better, a working demo of how this might work? > > Thanks, > Howard > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Your ajax responses can now output html and javascript embedded in <script> tags, with multiple <script> tags allowed, if you use :script=>true in your ajax calls. so you can do all kinds of scripting with the page, in an ajax response. while you can''t push to people, you can certainly queue up messages for clients. for extra speed, you could look into mysql memory tables (like a normal table, but, stored in memory == fast). then select events from that table where created_at > @session[''last_update'']. and use INSERT DELAYED or Thread.new to save the actual chat in another thread so the response is fast. courtenay On 7/11/05, nick-uKEOoZLWRHPYtjvyW6yDsg@public.gmane.org <nick-uKEOoZLWRHPYtjvyW6yDsg@public.gmane.org> wrote:> An ajax chat script is certainly very do-able. In fact, there''s a game > (www.kingdomofloathing.com) that has an ajax chat which is pretty cool. > > > I''ve been considering writing one for awhile now, and with the awesome > ajax support in rails I''m thinking that''s the way I''m going to go. > > > -------- Original Message -------- > > Subject: [Rails] AJAX Chat Script: Thinking out loud > > From: Lord Khaos <lordkhaos-Wuw85uim5zDR7s880joybQ@public.gmane.org> > > Date: Mon, July 11, 2005 12:58 pm > > To: Rails list <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > > > > Thanks to the the Agile Web Development with Rails book and Curt Hibb''s > > article on the subject, I''m slowly starting to get my head around AJAX, > > and have been thinking that an ajax chat application is certainly > > do''able. > > A quick Google on the subject provides confirmation that the idea is > > neither hair-brained, nor original :) > > > > http://dev.rubyonrails.com/ticket/945 > > http://www.plasticshore.com/viewEntry.php?id=205 > > http://brandedthoughts.co.uk/taxonomy/term/33 > > > > Alas, I have no clue as to where to get started...I would assume that > > periodically_call_remote would be at the heart of the app, along with > > form_remote_tag. I''m very foggy about the mechanics, however, of how the > > server would go about pumping out the input from a single person to the > > browsers of others participating in the chat. Would the comments need to > > be stored, at least temporarily in a db table so that the server could > > pull them as AR objects? > > > > Might anyone point me in the right direction for researching this more, > > or even better, a working demo of how this might work? > > > > Thanks, > > Howard > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Am 12.07.2005 um 07:52 schrieb Courtenay:> Your ajax responses can now output html and javascript embedded in > <script> tags, with multiple <script> tags allowed, if you use > :script=>true in your ajax calls.:script => true is on by default. Thomas