http4s icon indicating copy to clipboard operation
http4s copied to clipboard

Ember Client WebSocket support

Open RaasAhsan opened this issue 4 years ago • 9 comments

Now that we have ember-server WebSocket support, it shouldn't be much of a lift on the backend to build client support for it. I anticipate a bit of work around user API

RaasAhsan avatar Sep 19 '21 22:09 RaasAhsan

Besides ember-client I'd be thrilled to create e.g. a dom-websocket module implementing this as well, behind a common/shared abstraction.

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

armanbilge avatar Sep 19 '21 23:09 armanbilge

http4s-jdk-http-client has a WebSocket client. See WSClient.scala for the traits. We have our own WSFrame ADT there, as well es a "low level" and a "high level" interface due to differences in whether pings are automatically responded to, but these were mainly ideas/explorations.

I would be very glad to see an interface in http4s, and will happily port http4s-jdk-http-client to it!

amesgen avatar Oct 01 '21 16:10 amesgen

Yes, I've taken a look at it on a couple occasions, I'd love to see that (or a similar) interface in http4s proper! I'm looking at the reference for browser web sockets and it looks like it can be used to implement your high level interface.

I'm no expert on these things, but maybe if the high-level interface is more straight forward we can start by porting that to http4s-client?

armanbilge avatar Oct 01 '21 16:10 armanbilge

Sounds like a plan ! @amesgen whenever you have some time, could you open a branch in the http4s repo with the relevant interfaces based off series/0.22 (or whatever makes sense) ? That gives us a place to talk feasibility and design, but also get started on the ember implementation to use as another reference.

Some items I anticipate discussion around:

  • Client/WsClient decoupling
  • Parity with existing WS server machinery

RaasAhsan avatar Oct 02 '21 09:10 RaasAhsan

I think that a unified WebSocket interface in http4s would be huge, but it requires a lot of careful thought, and the traits from jdk-http-client should indeed only serve as a starting point. I will try to create an initial PR in the next weeks, but if anyone has more time to work on this, feel free to pick this up!

amesgen avatar Oct 11 '21 17:10 amesgen

As far as I see this is not completed. However, on the table in https://http4s.org/v0.23/docs/integrations.html "Ember" is said to have "Websocket Client". Is this an error in the documentation?

pvgoran avatar Aug 06 '22 11:08 pvgoran

@pvgoran woops, thanks for catching that, it is a mistake. A PR fixing would be much appreciated.

armanbilge avatar Aug 06 '22 13:08 armanbilge

This is proposed as a Google Summer of Code Project! https://typelevel.org/blog/2023/02/23/gsoc.html

armanbilge avatar Feb 25 '23 19:02 armanbilge

Hi everyone! I will be working on this for my gsoc project this summer.

danghieutrung avatar May 26 '23 13:05 danghieutrung