You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -18,18 +18,20 @@ To expose an endpoint using a [Netty](https://netty.io)-based server, first add
18
18
19
19
Then, use:
20
20
21
+
-`NettySyncServer().addEndpoints` to expose direct-style server endpoints (using Virtual Threads).
21
22
-`NettyFutureServer().addEndpoints` to expose `Future`-based server endpoints.
22
-
-`NettySyncServer().addEndpoints` to expose `Loom`-based server endpoints.
23
-
-`NettyCatsServer().addEndpoints` to expose `F`-based server endpoints, where `F` is any cats-effect supported effect. [Streaming](../endpoint/streaming.md) request and response bodies is supported with fs2.
24
-
-`NettyZioServer().addEndpoints` to expose `ZIO`-based server endpoints, where `R` represents ZIO requirements supported effect. Streaming is supported with ZIO Streams.
23
+
-`NettyCatsServer().addEndpoints` to expose `F`-based server endpoints, where `F` is any cats-effect supported effect.
24
+
[Streaming](../endpoint/streaming.md) request and response bodies is supported with fs2.
25
+
-`NettyZioServer().addEndpoints` to expose `ZIO`-based server endpoints, where `R` represents ZIO requirements
26
+
supported effect. Streaming is supported with ZIO Streams.
25
27
26
28
These methods require a single, or a list of `ServerEndpoint`s, which can be created by adding [server logic](logic.md)
@@ -46,23 +48,27 @@ val binding: Future[NettyFutureServerBinding] =
46
48
47
49
## Direct-style
48
50
49
-
The `tapir-netty-server-sync` server uses `Identity[T]` as its wrapper effect for compatibility; `Identity[A]` means in
51
+
The `tapir-netty-server-sync` server uses `Identity[T]` as its wrapper effect for compatibility; `Identity[A]` means in
50
52
fact just `A`, representing direct style. It is available only for Scala 3.
51
53
52
-
See [examples/helloWorldNettySyncServer.scala](https://github.com/softwaremill/tapir/blob/master/examples/src/main/scala/sttp/tapir/examples/helloWorldNettySyncServer.scala) for a full example.
In the Loom-based backend, Tapir uses [Ox](https://ox.softwaremill.com) to manage concurrency, and your transformation pipeline should be represented as `Flow[A] => Flow[B]`. Any forks started within this function will be run under a safely isolated internal scope.
159
-
See [examples/websocket/WebSocketNettySyncServer.scala](https://github.com/softwaremill/tapir/blob/master/examples/src/main/scala/sttp/tapir/examples/websocket/WebSocketNettySyncServer.scala) for a full example.
186
+
In the Loom-based backend, Tapir uses [Ox](https://ox.softwaremill.com) to manage concurrency, and your transformation
187
+
pipeline should be represented as `Flow[A] => Flow[B]`. Any forks started within this function will be run under a
The pipeline transforms a source of incoming web socket messages (received from the client), into a source of outgoing web socket messages (which will be sent to the client), within some concurrency scope. Once the incoming source is done, the client has closed the connection. In that case, remember to close the outgoing source as well: otherwise the scope will leak and won't be closed. An error will be logged if the outgoing channel is not closed within a timeout after a close frame is received.
@@ -166,7 +197,8 @@ The pipeline transforms a source of incoming web socket messages (received from
166
197
167
198
### tapir-netty-server-sync
168
199
169
-
The interpreter supports [SSE (Server Sent Events)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events).
A Netty server can be gracefully closed using the function `NettyFutureServerBinding.stop()` (and analogous functions available in Cats and ZIO bindings). This function ensures that the server will wait at most 10 seconds for in-flight requests to complete, while rejecting all new requests with 503 during this period. Afterwards, it closes all server resources.
0 commit comments