-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebSocket support for
caliban-quick
(#2150)
* Add websocket support for caliban-quick * Fix import error * Fix Scala 3 compiling * Make zio-http websocket config configurable * Fix content-type of graphiql endpoint * PR comment * Add method to construct WebSocketHooks from a StreamTransformer * Use caliban-quick in stitching example * Use port 8080 in stitching example * Fix scaladoc
- Loading branch information
1 parent
90838f1
commit 0552909
Showing
20 changed files
with
323 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
adapters/quick/src/main/scala/caliban/quick/WebSocketConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package caliban.quick | ||
|
||
import caliban.ws.WebSocketHooks | ||
import zio._ | ||
import zio.http.{ WebSocketConfig => ZWebSocketConfig } | ||
|
||
case class WebSocketConfig[-R]( | ||
keepAliveTime: Option[Duration], | ||
hooks: WebSocketHooks[R, Any], | ||
zHttpConfig: ZWebSocketConfig | ||
) { | ||
def withHooks[R1](newHooks: WebSocketHooks[R1, Any]): WebSocketConfig[R & R1] = | ||
copy(hooks = hooks ++ newHooks) | ||
|
||
def withKeepAliveTime(time: Duration): WebSocketConfig[R] = | ||
copy(keepAliveTime = Some(time)) | ||
|
||
def withZHttpConfig(newConfig: ZWebSocketConfig): WebSocketConfig[R] = | ||
copy(zHttpConfig = newConfig) | ||
} | ||
|
||
object WebSocketConfig { | ||
def default: WebSocketConfig[Any] = WebSocketConfig(None, WebSocketHooks.empty, ZWebSocketConfig.default) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.