user194076
user194076

Reputation: 9027

Socky Alternative

I'm in search of a RELIABLE websocket server for ROR 3.Now we're using socky. It is unreliable. We like it because it has flash fallback, so it suppose to work on older browsers...but again - it is unreliable. Do you know any good websocket server for ROR with fallback (i.e. supporting all browsers)

Upvotes: 0

Views: 1392

Answers (1)

sled
sled

Reputation: 14625

alternatives are:

  • socket.io (raw Websocket for NodeJS)
  • juggernaut (Complete Bayeux Protocol for NodeJS/Rails)
  • faye (Complete Bayeux Protocol for NodeJS/Rails) with a Ruby-Server

A tip: don't use ruby as websocket server, go for NodeJS - we handle thousands of messages every hour without any issue.

We used the most simple setup possible to make it work - and it works ;)

Our Setup:

  • Rails 3.0.9
  • Redis
  • NodeJS
  • Socket.IO

How we set it up:

Rails --PUB--> REDIS --SUB--> NodeJS --WEBSOCKET (SOCKET.IO)--> Client

Article Redis PubSub - How does it work?

Another tip: Avoid authentication if possible

Here's our case:

We have something like a project management tool with a virtual filesystem. Let's say you're viewing a folder while someone else of your team uploads a new file. Now we have to inform you that your view is out of the date - we send a message like:

folder_id | last_change_timestamp

to the channel folders:#{folder_id}

now the client (which listens to folders:#{folder_id} receives that messages and sees "whoops my view is out of date" and shows a message "Your view is outdated, please click >here< to refresh".

The good thing is that we don't need any authentication because:

  1. if you have no access to the project you would have to guess the folder_id to subscribe to the channel
  2. even if you manage to subscribe to the channel the only information you get is that something has changed - not more not less ;)

Upvotes: 8

Related Questions