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

No way to send continuous WebSocketFrame with Fs2 stream pipes #1465

Open
sguillaume-ledger opened this issue Jun 21, 2022 · 1 comment
Open

Comments

@sguillaume-ledger
Copy link

Hi,

I'm using sttp with tapir/http4s/fs2 to build a websocket server.
My websocket endpoint is described with tapir as:

  val instance = endpoint.get
    .in(PREFIX)
    .out(webSocketBodyRaw(Fs2Streams[IO]))

and my business logic returns a fs2.Pipe[IO, WebSocketFrame, WebSocketFrame]

I have an use case when I would like to send a continuous WebSocketFrame (ie make a stream emit a continuous WebSocketFrame)
which I can't since WebSocketFrame exposes the finalFragment parameter only, not the isContinuation one

isContinuation is exposed in sttp.ws.WebSocket#send which is called by sttp.client3.impl.fs2.Fs2WebSockets#handleThroughPipe
with isContinuation always set to false.

Would that be possible to somehow expose the isContinuation flag when using the web socket with stream pipes ?

Thanks !

Regards,
Sebastien

@adamw
Copy link
Member

adamw commented Jun 21, 2022

Hm I think this should be fixed in Fs2WebSockets.handleThroughPipe itself. If we get a frame with finalFragment = false, it means that all further frames (except this one), until we get a final one, should have isContinuation = true. So this can be computed, doesn't have to be exposed to the user.

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