You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
I am trying to make faye work for my app. but getting 502 error after three successful requests at browser and connection halts. Below are my config details.
nginx.conf =>
require 'faye'
require File.expand_path('../config/initializers/faye_token.rb', __FILE__)
class ServerAuth
def incoming(message, callback)
if message['channel'] !~ %r{^/meta/}
if message['ext']['auth_token'] != FAYE_TOKEN
message['error'] = 'Invalid authentication token'
end
end
callback.call(message)
end
def outgoing(message, callback)
if message['ext'] && message['ext']['auth_token']
message['ext'] = {}
end
callback.call(message)
end
end
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 90)
faye_server.add_extension(ServerAuth.new)
run faye_server
hitting below command successfully starts Thin web server RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production
When I added below code in my view file, it shows below in Network of browser dev tools.
Request URL: https://www.mydomain.com/faye.js
Request Method: GET
Status Code: 200 OK (from disk cache)
Remote Address: xx.xx.xxx.xx:443
Referrer Policy: no-referrer-when-downgrade
Request URL: https://www.mydomain.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmeta%2Fhandshake%22%2C%22version%22%3A%221.0%22%2C%22supportedConnectionTypes%22%3A%5B%22websocket%22%2C%22eventsource%22%2C%22long-polling%22%2C%22cross-origin-long-polling%22%2C%22callback-polling%22%5D%2C%22id%22%3A%221%22%7D%5D&jsonp=__jsonp1__
Request Method: GET
Status Code: 200 OK
Remote Address: xx.xx.xxx.xx:443
Referrer Policy: no-referrer-when-downgrade
Query string parameters
message: [{"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["websocket","eventsource","long-polling","cross-origin-long-polling","callback-polling"],"id":"1"}]
jsonp: __jsonp1__
Request URL: wss://www.mydomain.com/faye
Request Method: GET
Status Code: 101 Switching Protocols
Request URL: https://www.mydomain.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmeta%2Fconnect%22%2C%22clientId%22%3A%22iwuhtrmjgzgzb0cmsbvx98t9aetj3na%22%2C%22connectionType%22%3A%22callback-polling%22%2C%22id%22%3A%222%22%2C%22advice%22%3A%7B%22timeout%22%3A0%7D%7D%2C%7B%22channel%22%3A%22%2Fmeta%2Fsubscribe%22%2C%22clientId%22%3A%22iwuhtrmjgzgzb0cmsbvx98t9aetj3na%22%2C%22subscription%22%3A%22%2Fleads%2Fagent_id%3D2%22%2C%22id%22%3A%223%22%2C%22ext%22%3A%7B%22private_pub_signature%22%3A%22a5b95a0fdc2e2e9c4fcde9739e10d11a01d99f95%22%2C%22private_pub_timestamp%22%3A1534514001429%7D%7D%5D&jsonp=__jsonp2__
Request Method: GET
Status Code: 200 OK
Remote Address: xx.xx.xxx.xx:443
Referrer Policy: no-referrer-when-downgrade
Query string parameters
message: [{"channel":"/meta/connect","clientId":"iwuhtrmjgzgzb0cmsbvx98t9aetj3na","connectionType":"callback-polling","id":"2","advice":{"timeout":0}},{"channel":"/meta/subscribe","clientId":"iwuhtrmjgzgzb0cmsbvx98t9aetj3na","subscription":"/leads/agent_id=2","id":"3","ext":{"private_pub_signature":"a5b95a0fdc2e2e9c4fcde9739e10d11a01d99f95","private_pub_timestamp":1534514001429}}]
jsonp: __jsonp2__
Request URL: https://www.mydomain.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmeta%2Fconnect%22%2C%22clientId%22%3A%22iwuhtrmjgzgzb0cmsbvx98t9aetj3na%22%2C%22connectionType%22%3A%22callback-polling%22%2C%22id%22%3A%224%22%7D%5D&jsonp=__jsonp3__
Request Method: GET
Status Code: 502 Bad Gateway
Remote Address: xx.xx.xxx.xx:443
Referrer Policy: no-referrer-when-downgrade
Query string parameters
message: [{"channel":"/meta/connect","clientId":"iwuhtrmjgzgzb0cmsbvx98t9aetj3na","connectionType":"callback-polling","id":"4"}]
jsonp: __jsonp3__
Nothing happens after this request.
When I try to curl faye with below command, I get success message curl http://localhost:9292/faye -d 'message={"channel":"/leads/agent_id_2", "data":"hello", "ext":{"private_pub_token":"oidb2d36a8c4b83db97dfh4147735829bc370036c0552e7d4eb945f9c90c4b"}}
Response: [{"channel":"/leads/agent_id_2","successful":true}]
But nothing happens at client side.
Can anyone please tell me what could be the reason behing 502 bad request? or overall configuration?
P.S I am using AWS & HTTPS
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
I am trying to make faye work for my app. but getting 502 error after three successful requests at browser and connection halts. Below are my config details.
nginx.conf =>
config/private_pub.yml =>
faye.ru =>
private_pub.ru =>
hitting below command successfully starts Thin web server
RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production
When I added below code in my view file, it shows below in Network of browser dev tools.
Nothing happens after this request.
When I try to curl faye with below command, I get success message
curl http://localhost:9292/faye -d 'message={"channel":"/leads/agent_id_2", "data":"hello", "ext":{"private_pub_token":"oidb2d36a8c4b83db97dfh4147735829bc370036c0552e7d4eb945f9c90c4b"}}
Response:
[{"channel":"/leads/agent_id_2","successful":true}]
But nothing happens at client side.
Can anyone please tell me what could be the reason behing 502 bad request? or overall configuration?
P.S I am using AWS & HTTPS
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: