LiveData

LiveData is a rubygem. This gem is used to implement the applications like chat, live process montior, etc.,

Installation

Step 1 :-
	Add the livedata gem in config/environment.rb

config.gem “livedata”

Step 2 :-

Add the following configuration in the config/environments/development.rb, config/environments/production.rb and config/environments/test.rb config.threadsafe!

Example

Class MainController < ApplicationController

def get_msg user_id = params || “test” chat = LiveData.get_channel(‘chat’) || LiveData.create_channel(‘chat’) user = chat.get_user( user_id ) || chat.create_user( user_id ) render :text => user.read end

def send_msg user_id = params || “test” message = params || “Nothing”

chat = LiveData.get_channel(‘chat’) || LiveData.create_channel(‘chat’) user = chat.get_user( user_id ) || chat.create_user( user_id )

user.write( message ) render :text => ‘Finesh’ end end

== Run Webrick Server ruby script/server -b 0.0.0.0 -p 3000 == Browser Open two tabs in the web browser First tab :- localhost:3000/main/get_msg/tester Second Tab :- localhost:3000/main/send_msg/tester?msg=Hello World