Closed ghost closed 12 years ago
curl http://localhost:9292/faye -d 'message={"channel":"/messages/new", "data":"hello", "ext":"secret"}' curl http://localhost:9292/faye -d 'message={"channel":"/messages/new", "data":"hello", "ext":"{'private_pub_token':'secret'}"}'
Both return:
[{"channel":"/messages/new","error":"Incorrect token.","successful":false}]
Note: I'm using the default config under development, I even tried changing the production secret_token to secret. I also tried faye 0.7.1, faye 0.8.0 and faye 0.8.1
@chemicalfire same here can you tell me what you did ?
I get the same error - does anyone here figured this out?
@randika is your application public? If not can you tell me the steps you did before getting the error?
@gregmolnar it is a private project. But the code is exactly same as from this repo - https://github.com/IamNaN/heroku_private_pub
curl http://localhost:9292/faye -d 'message={"channel":"/messages/new", "data":"hello", "ext":"{'private_pub_token':'mykey'}"}'
[{"channel":"/messages/new","error":"Incorrect token.","successful":false}]
The curl request is not in the correct format as far as I see. It should be rather like this:
curl http://localhost:9292/faye -d 'message={"channel":"/messages/new", "data":"hello", "ext":{"private_pub_token":"mykey"}}'
@gregmolnar that url was taken from a blog post and never checked it until now - It works just fine now. Really appreciate your help. thanks
No worries, I am glad if I helped.
I have successfully gotten faye to work alone (pushing messages to both users), but when incorporating private_pub I have been having problems. Now the faye server starts without any errors but it still does not seem to work as expected.
Publish_to doesn't seem to work, when I wrap my append in my create.js.erb, it simply does not work (Doesn't post the message for either user).
<% publish_to "/messages/new" do %> $("#chat").append("<%= escape_javascript render(@message) %>"); <% end %>
When I remove the publish too, it will at least post for the single user. Anyone have any suggestions on how to debug this? I can upload my whole project to github if that would be helpful in diagnosis. I followed every step in the guide and I'm using rails 3.2.
I also tried doing publish_to in the controller and still nothing happened.