Group chat room in Rails


Introduction:

Chat Engine is a lightweight rails engine that heavily uses jQuery and memcached to implement a very simple group chat room.

Features:

  • You must enter a nickname to be part of the chat room.
  • All logged in users are shown in the user list
  • Lines in the chat that mention a users nickname are highlighted.
  • Inactivity timer will logout users from the client side.
  • rake task to logout users whose browsers do not allow ajax requests in the unload event.
  • The ability to mute specific users (from script/console). Muted users will see their own messages, but no one else will.

 Implementation:

install chat-engine

 ./script/plugin install git://github.com/amiel/chat-engine.git

copy assets

rake chat:sync

include assets, don’t forget jquery

<%= stylesheet_link_tag ‘chat’ %>

<%= javascript_include_tag ‘jquery-x.x.x.js’, ‘auto_scroll’, ‘chat’ %>

use the chat_overlay partial

 <%= render :partial => ‘chats/chat_overlay’ %>

Note: make sure you have Jrails installed and the prototypes are properly included.

Source: Railscarma.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s