Skip to content
This repository has been archived by the owner on May 25, 2018. It is now read-only.

Can I get a response from client side? #50

Open
brlo opened this issue Aug 1, 2013 · 4 comments
Open

Can I get a response from client side? #50

brlo opened this issue Aug 1, 2013 · 4 comments

Comments

@brlo
Copy link

brlo commented Aug 1, 2013

Hello,

I want to take some data on server side (RoR with faye-rails) from client side (Ruby + faye client). The problem is that the client is behind a firewall and because of it, I connecting client to server and wait for any command from it. Client can publish back to channel all requested data but I can't understand how I can take back this message in the server controller after publishing request to client channel.

This is the controller action:

def send_request
    require 'net/http'
    publication = ClientController.publish("/client", params[:query])
    publication.callback do
            @res "[PUBLISH SUCCEEDED]"
    end
    publication.errback do |error|
            @res = "[PUBLISH FAILED] #{error.inspect}"
    end
end

How I can take a response from client in the usual controller?

Thanks a lot.

@jimsynz
Copy link
Owner

jimsynz commented Aug 1, 2013

Are you using Rails 4?

@brlo
Copy link
Author

brlo commented Aug 1, 2013

Hello. First of all, thanks for your tool.
If it's important, I can use Rails 4, but currently I'm using Rails 3.2.14.
Thanks for your time.

@jimsynz
Copy link
Owner

jimsynz commented Aug 1, 2013

Just checking, because it's break on Rails 4 at the moment :)

I don't really understand the problem, perhaps you can post a gist with the relevant information?

@brlo
Copy link
Author

brlo commented Sep 13, 2013

I made it with faye-websocket. Ruby clients (with dynamic IP) connects to my Rails middleware faye-websocket server. When I need information from any client I call the method from middleware and wait N seconds for response from client through websocket.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants