Closed kbaum closed 8 years ago
I assume you're running tests over SSL? Obviously the easiest solution would be to not do so, but understand if you would rather not. I think the best way to support SSL would be to support passing in additional EventMachine::WebSocket and Thin options, allowing you to configure each to run SSL when needed. I'll work on that either tonight or sometime this week.
I had not been running my tests with ssl but got burned with tests passing but things being broken in prod.
That config option sounds great!
Sent from my iPhone
On Sep 17, 2013, at 4:39 PM, Tristan Dunn notifications@github.com wrote:
I assume you're running tests over SSL? Obviously the easiest solution would be to not do so, but understand if you would rather not. I think the best way to support SSL would be to support passing in additional EventMachine::WebSocket and Thin options, allowing you to configure each to run SSL when needed. I'll work on that either tonight or sometime this week.
— Reply to this email directly or view it on GitHub.
Added support on the custom-options branch. Let me know if you have any feedback. Not quite ready to merge and release until I get a chance to test it out some more.
It looks like custom-options was merged but i am a little confused on how i would go about configuring pusher-fake to work with ssl.
thx!
pusher-fake/server.rb now uses socket_options
for the em-websocket options and web_options
for the thin options, meaning you can configure them however you want. Unfortunately for now you'll have to read their documentation for how to enable SSL for either.
And I'll release a new version containing the changes tonight or tomorrow, I've been out of town.
Fixed in fee2c8328f9db93002f4ae442af02d6ad98a866b and 4e4f97c9404a2e9f7a16ae85eaca1caa39a34cde.
Cool. Thanks for your help on this. For the time being i have been using just straight pusher for my tests and it hasn't been so bad.
On Tue, Oct 29, 2013 at 10:25 PM, Tristan Dunn notifications@github.comwrote:
pusher-fake/server.rbhttps://github.com/tristandunn/pusher-fake/blob/master/lib/pusher-fake/server.rbnow uses socket_options for the em-websockethttps://github.com/igrigorik/em-websocketoptions and web_options for the thin https://github.com/macournoyer/thin/ options, meaning you can configure them however you want. Unfortunately for now you'll have to read their documentation for how to enable SSL for either.
And I'll release a new version containing the changes tonight or tomorrow, I've been out of town.
— Reply to this email directly or view it on GitHubhttps://github.com/tristandunn/pusher-fake/issues/19#issuecomment-27360725 .
In case you missed it and want to give it a go, I released 0.11.0 with the latest changes.
@tristandunn - ok thx!
@tristandunn - may be a dumb question but what is em-websocket and thin used for within pusher fake? Do they both have to be on ssl? Different ports i guess?
thx!
@tristandunn - Tried unsuccessfully configuring ssl this morning. Here's what i had:
https://gist.github.com/7302859
And i got this error trying to publish from ruby to pusher:
HTTPClient::KeepAliveDisconnected (HTTPClient::KeepAliveDisconnected):
app/background_jobs/jobs/dashboard_query_job.rb:12:in `perform'
app/background_jobs/jobs/dashboard_queries_job.rb:20:in `block in perform'
app/background_jobs/jobs/dashboard_queries_job.rb:18:in `each'
app/background_jobs/jobs/dashboard_queries_job.rb:18:in `perform'
app/controllers/building_traffic_controller.rb:11:in `block (2 levels) in show'
app/controllers/building_traffic_controller.rb:7:in `show'
@tristandunn - played around some more. Noticed that the browser still seems to be hitting pusher.com. Also output my Pusher js configuration:
https://www.monosnap.com/image/14s7UzaBrVSZWXfBXChKE1CYo
I see it is still referencing pusher.com. Is that correct?
thx!
em-websocket is for WebSockets and thin is for the HTTP API.
I'm not sure on the HTTPClient::KeepAliveDisconnected
error, it may be related the host issue.
It shouldn't be hitting pusher.com
. Does that happen in HTTP too? If not then there must be some configuration we're missing for customizing the HTTPS endpoints.
Hi @tristandunn ,
Thanks for putting together this project.
Regarding this closed bug labeled, 'Support for SSL'. I looked at your changes, and it doesn't appear that they support configuration for SSL on the underlying Thin server. I think this bug should be left open to let people know SSL is not supported by the project. I don't see a way to configure SSL in the pusher-fake-example through the exposed configuration options of pusher-fake.
Incidentally, I'm here because my pusher-js client is instantiated with 'encrypted: false' and 'enabledTransports: ["ws"]', but it keeps throwing the following ssl errors in a row and then failing to connect to the pusher fake example Thin/EventMachine server:
[15704:15743:0312/072344:ERROR:ssl_client_socket_openssl.cc(1149)] handshake failed; returned -1, SSL error code 1, net_error -100
[15704:15743:0312/072344:ERROR:ssl_client_socket_openssl.cc(1149)] handshake failed; returned -1, SSL error code 1, net_error -100
[15704:15743:0312/072344:ERROR:ssl_client_socket_openssl.cc(1149)] handshake failed; returned -1, SSL error code 1, net_error -100
[15704:15704:0312/072344:INFO:CONSOLE(2378)] "WebSocket connection to 'ws://localhost:50389/app/
First, I'm confused as to why it's trying to use SSL when encrypted
is set to false.
Second, the WebSocket server receives all socket_options
and the Thin server is passed other options at creation. So you can create a secure WebSocket server and provide Thin SSL options if you wish. I don't support it by default because it would likely create more support issues. And the library is meant for development and testing, which I don't think necessarily requires SSL.
That being said, I'll reopen this issue for me to add these details to the README for people who wish to run it with SSL.
Added the details in 8b6f8e4f5a5160909861502df83c8e9a69d24a22.
Thanks, Tristan. I'm coming from a java and python background, so configuring options in a ruby/rails environment is new to me. This additional documentation helps.
For completeness, here's a link to the issue where I got to the bottom of my ssl_client_socket_openssl.cc bug. It had nothing to do with any problems in pusher-fake.
Any way to get pusher-fake to work from ssl pages? I have tried it and the browser cannot communicate with a non-ssl url.
thx