vbmithr / ocaml-websocket

Websocket library for OCaml
ISC License
163 stars 44 forks source link

Async support #19

Closed SGrondin closed 8 years ago

SGrondin commented 9 years ago

Hi,

I'd love to use your package as part of an application I'm currently writing that makes heavy use of Async and Cohttp. Is there any plan to add Async support the same way that Cohttp does by abstracting away the logic and offering both Lwt and Async as options?

Thanks

SGrondin commented 9 years ago

Also, version 0.9 doesn't seem to be on OPAM? https://opam.ocaml.org/packages/websocket/websocket.0.8.1/

vbmithr commented 9 years ago

On 19/11/2014 01:09, Simon Grondin wrote:

Also, version 0.9 doesn't seem to be on OPAM? https://opam.ocaml.org/packages/websocket/websocket.0.8.1/

Yes, I'm planning to do a complete rewrite of this library along the lines of http://github.com/dbuenzli/nbcodec design.

So it's gonna be very easy to abstract over any concurrency library. As for the version not in OPAM, yes, for some reason it does not pass the automated build tests, but I'm unable to reproduce. Please pin the package to my git version.

Vincent

SGrondin commented 9 years ago

I wasn't even able to compile it yesterday because of some interface changes they've made in cohttp. My fork works, but I still need to do a few more tests, then I'll do a PR.

vbmithr commented 9 years ago

I should start working on this soon. I need to abstract the library both from the monadic concurrency library (Lwt/Async) and the SSL handling (ocaml-tls/async_ssl).

rgrinberg commented 9 years ago

Can you accomplish the latter by using conduit?

vbmithr commented 9 years ago

On 23/05/2015 21:28, Rudi Grinberg wrote:

Can you accomplish the latter by using conduit?

Good question. And good idea too :)

Vincent

hhugo commented 9 years ago

:+1:

vbmithr commented 9 years ago

Initial async support (client) has been pushed to master. I'm gonna use the client part, so I'm gonna test mostly this. Server has not been tested yet.

copy commented 8 years ago

One code question: In line 175 and 176 we create a Reader and Writer from pipes. Wouldn't it be more efficient to accept Reader and Writer, since this is also what Tcp.Server.create provides?

By the way, I'm using the server in a small project and it works (even though the interface is a bit crude).

vbmithr commented 8 years ago

Ah that's good news that the server works, it's so rare that something works without being tested (especially when it's me writing the code).

As for your question, I don't remember why I did it like this and it was not AFAIR a question of efficiency. If you manage to patch this to something equivalent with a simpler interface, I'll take it :)

vbmithr commented 8 years ago

We now have client and server async support. Closing this.