0

I am creating small chat app with rails, I am using private_pub (built on top of faye) gem by Ryan. I followed all steps as per his screencast , but i can't get it working. I am getting below error

undefined method `publish_to' for #<#<Class:0x007f95964f5398>:0x007f95925e6378>

I am including publish_to in chat.js.coffee.erb

msgJson = (message)->
    time = $.now()
    <% publish_to "/chats/new" do %>
      append_chat_message(time,message)
    <% end %>

Both my thin and faye servers are running , i used below command to start he faye

rackup private_pub.ru -s thin -E production

I included subscribe_to line in my template

<%= subscribe_to "/chats/new" %>

and also added assets

//= require private_pub

I don't know , where its going wrong. Any help will be useful.

Senthil
  • 946
  • 1
  • 14
  • 34

2 Answers2

0

I solved this myself, if we using Private_pub only the Rails app can publish to channels , we need write the pusblish_to function in call back file of ajax call.

Senthil
  • 946
  • 1
  • 14
  • 34
0

You've to install

gem 'thin' 

and then restart the server again. It worked for me. Hope it works for you also.

Prabhakar
  • 6,458
  • 2
  • 40
  • 51