0.0
No commit activity in last 3 years
No release in over 3 years
This gem makes it easier to build an AJAX chat project. Designed for Rack-rscript
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.7.0, ~> 0.7
 Project Readme

Introducing the H2G Ajax Chat gem

require 'h2g_ajaxchat'


ac = AjaxChat.new(ChatCore.new)

req1 = DummyRequest.new
ac.req(req1).index
ac.req(req1).login_post 'Jim'
# logs in with username 'Jim'

req2 = DummyRequest.new
ac.req(req2).index
ac.req(req2).login_post 'Bob'
# logs in with username 'Bob'

ac.req(req1).chatter
s  = ac.req(req1).chatter('hello')


puts ac.req(req2).chatter
ac.req(req2).chatter 'anybody here?'
puts ac.req(req1).chatter

The above example can copied pasted into an IRB session to observe the chat conversation between 2 users. The DummyRequest object is a RACK session object substitute and is used to store the username and the identifier of the last message read.

Here we can see user Jim logs in, and then user Bob logs in. Then Jim says hello, and Bob replies with the message anybody here?

The method *chatter() is used to both display messages and send messages.

Resources

chat gem ajax h2gajaxchat rack