Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange Disconnect Issue with HTTPS #14

Open
avaitla opened this issue Jan 31, 2012 · 3 comments
Open

Strange Disconnect Issue with HTTPS #14

avaitla opened this issue Jan 31, 2012 · 3 comments

Comments

@avaitla
Copy link

avaitla commented Jan 31, 2012

First off, I think this is a pretty awesome package! Thanks for all your great work on it!

Apologies if I misunderstand something, I've just started working with Snap and websockets.

I'm trying to setup a basic web sockets connection with SSL. I found your other project https://github.com/jaspervdj/websockets-snap, and tried to modify it to support this pattern. For the most part it works, but fails on disconnects, when the user closes the browser.

The Server code is here: https://gist.github.com/1709572
The Client Javascript code is here: https://gist.github.com/1709573
To generate a certificate: https://gist.github.com/1709595

The client code is no different from your example except for an additional line with "wss".

I spent quite some time trying to fix it myself, but unsuccessfully. It doesn't seem to be an issue with the browser, as I verified with the command "tcpdump -i lo0 port 9160", and chrome is sending disconnects when the browser is closed, both for regular http and https (secure websockets).

I also did some digging into the Snap source but it is successfully getting the disconnects and shutting down the sockets appropriately (tested lines 40-41 of https://github.com/snapframework/snap-server/blob/master/src/Snap/Internal/Http/Server/ListenHelpers.hs).

I'm still struggling to understand what escapeHttp does and how it works. When it says "escapes all http traffic", does that mean it drops any incoming http packets?

This might be an issue with snap-server, but given the fact it is correctly closing https and http traffic correctly, I thought it might be more appropriate to list the issue here.

Please let me know if I can help in any way, or there is any clarification required.

@jaspervdj
Copy link
Owner

Related: snapframework/snap-server#20

@avaitla
Copy link
Author

avaitla commented Jan 31, 2012

Thanks! Yeah, that patch seems to do it. How did u figure out that was the issue by the way?

@jaspervdj
Copy link
Owner

Patience and studying the snap debug log files. However, I talked with Gregory and this patch is unlikely to be applied for now, since it actual is an exception. So, I basically need to find some better way of detecting a disconnect, which I haven't been able to wrap my head around yet.

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

No branches or pull requests

2 participants