I am trying to use a push mechanism using the websocket-rails stone in a ROR application.
I basically did the following.
my application.js
//= require jquery //= require jquery_ujs //= require websocket_rails/main $(function(){ // connect to server like normal var dispatcher = new WebSocketRails('localhost:3000/websocket'); // subscribe to the channel var channel = dispatcher.subscribe('products'); // bind to a channel event channel.bind('new', function(data) { console.log('channel event received: ' + data); }); });
then I launched a thin server on port 3000
Then I from the rails console, I entered the following command.
WebsocketRails[:products].trigger(:new, Product.last)
But nothing was printed in the browser console.
Am I missing some configuration settings?
thanks
Gagan source share