Rahul
Rahul

Reputation: 47136

Implementing chat in Rails

I am trying to implement a chat module in my rails application. I looked into this railscast Faye tutorial. More through the tutorial, Ryan mentions about broadcasting the messages but what I want is more like private conversations between the clients instead of broadcasting.

Is it possible to do that through faye? or is there a better way of implementing chat in rails?

Upvotes: 0

Views: 1860

Answers (3)

Joseph N.
Joseph N.

Reputation: 2457

I have used Ryan's tutorial on private_pub to achieve an a Gmail like instant messaging feature. It's actually not very complex. See how I achieved it in this tutorial http://goo.gl/l3e8zN

Upvotes: 1

Ismael
Ismael

Reputation: 16730

There is a gem that handles the autentications for you for faye, so users can only listen on channels you subscribe them to. There is also a railscast talking about that gem. https://github.com/ryanb/private_pub

Upvotes: 2

d11wtq
d11wtq

Reputation: 35318

I don't know much about Faye, but assuming the principles are the same as with something like pure node.js and websockets, you'd divide the channels that can be subscribed to down into as many chats as there are occurring, then you'd require some sort of authentication before a client can subscribe to that channel, of which there are numerous approaches, as with most authentication systems (e.g. shared secret, username/password, challenge/response etc).

Upvotes: 1

Related Questions