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

Websocket and SSL on many ports #1

Open
olleharstedt opened this issue Jun 27, 2013 · 4 comments
Open

Websocket and SSL on many ports #1

olleharstedt opened this issue Jun 27, 2013 · 4 comments

Comments

@olleharstedt
Copy link

Hello

I'm using your library for my card playing webpage (thanks for that)! Now I try to switch to SSL, but the websocket will no longer connect (I've also switched from "ws://..." to "wss://..."). This is the error I receive:

Lwt_stream.Empty[Thu Jun 27 12:44:44 2013] [OcamlNet] /cgi-bin/drakskatten_ajax: Netchannels.Closed_channel (Status 500), referer: https://127.0.1.2/cgi-bin/drakskatten

I'm using the cgi app as a small websocket server, where each instance listens on a unique port, starting from 8080.

Do you know what's going on? Is it apache? Or should I use the Lwt_ssl socket type instead of the regular?

Loading webpages from the cgi works properly, even with SSL. Websocket works without SSL, but not with.

Grateful for your help
Olle

@vbmithr
Copy link

vbmithr commented Jun 27, 2013

On 27/06/2013 17:01, olleharstedt wrote:

Hello

I'm using your library for my card playing webpage (thanks for that)!
Now I try to switch to SSL, but the websocket will no longer connect
(I've also switched from "ws://..." to "wss://..."). This is the error I
receive:

Lwt_stream.Empty[Thu Jun 27 12:44:44 2013] [OcamlNet]
/cgi-bin/drakskatten_ajax: Netchannels.Closed_channel (Status 500),
referer: https://127.0.1.2/cgi-bin/drakskatten

I'm using the cgi app as a small websocket server, where each instance
listens on a unique port, starting from 8080.

Do you know what's going on? Is it apache? Or should I use the Lwt_ssl
socket type instead of the regular?

Loading webpages from the cgi works properly, even with SSL. Websocket
works without SSL, but not with.

Grateful for your help
Olle

I’m going to have a look tomorrow.
Thanks for your interest in the library :)

Vincent

@vbmithr
Copy link

vbmithr commented Jun 28, 2013

Oh, I thought it was MY websocket library. Sorry :)

@olleharstedt
Copy link
Author

Ah, no, not ocaml-websocket, but lwt-websocket. :)

Do you know how to use websockets with SSL? Just switching to "wss://..." doesn't seem enough. This is the setup code I use. Should I use another socket type to get it to work with SSL?

   let start_websocket env = 
     let addr_inet = Unix.ADDR_INET (Unix.inet_addr_of_string env#addr, env#port) in 
     let sock_listen = Lwt_unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in 

     (** setup listen socket *) 
     Lwt_unix.setsockopt sock_listen Unix.SO_REUSEADDR true; 
     Lwt_unix.bind sock_listen addr_inet; 
     Lwt_unix.listen sock_listen 5; 
     ...

Apache2 takes care of the SSL, so I'm at bit of a lost, here.

@vbmithr
Copy link

vbmithr commented Jun 29, 2013

On 28/06/2013 15:34, olleharstedt wrote:

It is yours. Not sure where the fault is, though. Do you know how to use websockets with SSL? Just switching to"wss://..." doesn't seem enough.

Ok, you're talking about my fork of this library then. I wrote another
websocket library completely from scratch (ocaml-websocket) that I hope
is working over SSL (not even sure…). I never used this library
actually, I might have a look in some time but I'm currently too busy.

Good luck,

Vincent

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