问题
I have searched for some time investigating several technologies to build an simple instant messaging system for a ruby on rails app. It seems very complicated as I haven't found any implementations that are cross browser or any 1-1 proof of concept at all.
Looked into:
- xmpp clients ( there is Candy on github only supports group chat )
- xmpp servers & Rails ( lot of hassle no good integration )
- Juggernaut ( no 1-1 , not supported by Internet Explorer cause of web sockets used)
- Private Pub by ryan bates ( seems to be able to do the trick but as ruby newbie with little documentation on this cannot get this figured )
Can anyone suggest me a instant messenger for rails:
- that is Cross browser
- has good documentation, example of implementation
- Instant Messenger where User A talks to User B and User B talks to User A
I really have no idea anymore how I would implement this, anyone can give me advise on how this problem could be tackled? thx
回答1:
As Eric said, there isn't one. Messaging is a very difficult thing to do.
Right now I'm using Pubnub, which is an external service. There isn't very good documentation on Rails integration, so you'll just have to try to do it yourself.
On the better documented side, there's Faye, but this is an internal process and requires two instances to be running (one to respond to Faye requests, and one to run your app). This was a little trickier (and more expensive) to do on Heroku, so I just stuck to Pubnub.
In terms of Faye documentation, check out this Railscast, and for privacy, check out Private Pub.
edit: if you think Private Pub is hard to integrate.. well, not to be mean, but perhaps you should try to learn more about Rails and Javascript before you delve into this matter, as it's not an easy thing to do (even though it seems like it should be)
edit 2: Also, for faye, this tutorial might help you out.
You might be better off using Node.js for this type of thing.
回答2:
Work in progress: full facebook clone
https://github.com/rubytastic/im
please contribute the code is to be fixed and still wacky!
来源:https://stackoverflow.com/questions/9383482/instant-messenger-implementation-for-rails