We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The HttpHandler supports perfect symmetry, where it can be used as the interface for a server and client.
HttpHandler
Currently, the WsHandler is only supported on the server-side, making it more of a chore to fake websocket connections.
WsHandler
Workaround
class MyService( private val openWs: (Uri) -> Websocket ) { fun open(): Websocket { return openWs(Uri.of("ws://foo")) } } val realService = MyService { uri -> WebsocketClient.nonBlocking(uri) } val testWs = websockets() val testService = MyService { uri -> val request = Request(Method.GET, uri) testWs.testWebsocket(request) }
Desired
class MyService2( private val wsHandler: WsHandler ) { fun open(): Websocket { val request = Request(Method.GET, "ws://foo") return wsHandler(request).nonBlocking() } } val realService2 = MyService2(JavaWebSocketClient()) val testWs2 = websockets() val testService2 = MyService2(testWs2)
Does this seem reasonable and doable?
The text was updated successfully, but these errors were encountered:
I'm struggling to see how this could work TBH. Also, I'd probably strive to have the open function as:
operator fun invoke(req: Request): Websocket
Have a go though - it might fit in your brain! 🙃
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The
HttpHandler
supports perfect symmetry, where it can be used as the interface for a server and client.Currently, the
WsHandler
is only supported on the server-side, making it more of a chore to fake websocket connections.Workaround
Desired
Does this seem reasonable and doable?
The text was updated successfully, but these errors were encountered: