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

Symmetric ws handler #1061

Closed

Conversation

oharaandrew314
Copy link
Contributor

Closes #1049

You can finally inject a SymmetricWsHandler into your application and have it be implemented by a server or a client. This will make testing websocket clients much easier.

Supported Websocket clients:

  • JavaWebSocketClient (TooTallNate/Java-WebSocket)

@oharaandrew314
Copy link
Contributor Author

Tencent integration test seems to be stuck

@s4nchez
Copy link
Collaborator

s4nchez commented Feb 20, 2024

That's strange, given there are no integration tests for Tencent (we only have a Placholder object in the test directory)

@oharaandrew314
Copy link
Contributor Author

Is this likely to be an problem on my end?

@s4nchez
Copy link
Collaborator

s4nchez commented Feb 21, 2024

I can reproduce it locally using ./gradlew :test --tests guide.howto.testing_websocket_clients.GreetingClientTest

I didn't have a chance to look too closely, but I can confirm that test is getting stuck, so I suspect it's either a problem in the JavaWebsocketClient or something related to the test setup.

@codecov-commenter
Copy link

codecov-commenter commented Feb 22, 2024

Codecov Report

Attention: Patch coverage is 63.63636% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 84.51%. Comparing base (4410347) to head (77c28c1).
Report is 3 commits behind head on master.

❗ Current head 77c28c1 differs from pull request most recent head bf32030. Consider uploading reports for the commit bf32030 to get more accurate results

Files Patch % Lines
...src/main/kotlin/org/http4k/client/JavaWsHandler.kt 66.66% 2 Missing and 3 partials ⚠️
.../kotlin/org/http4k/websocket/SymmetricWsHandler.kt 50.00% 2 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1061      +/-   ##
============================================
- Coverage     84.53%   84.51%   -0.02%     
- Complexity     2014     2016       +2     
============================================
  Files           579      581       +2     
  Lines         13241    13263      +22     
  Branches       1741     1745       +4     
============================================
+ Hits          11193    11209      +16     
- Misses         1246     1248       +2     
- Partials        802      806       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oharaandrew314
Copy link
Contributor Author

I fixed my garbage test and the build is passing now. Thanks @s4nchez for finding it for me.

@oharaandrew314
Copy link
Contributor Author

@s4nchez Did you mean to push your server contract changes to this branch?

@s4nchez
Copy link
Collaborator

s4nchez commented Feb 23, 2024

@oharaandrew314 no, that was a mistake and I've reverted it. Sorry for the confusion.

@daviddenton
Copy link
Member

There is a question about if we can make this work more generally - ie. is the more symmetric implementation os WsHandler a better fit long term for http4k. For this, we'd also need to work out if we can mount it onto a server in the same way as the current implementation.

This could also apply to SSE as well.

@oharaandrew314
Copy link
Contributor Author

oharaandrew314 commented Feb 24, 2024 via email

@daviddenton
Copy link
Member

I think we're happy enough to support a breaking change as long as it retains the simplicity and testability. We could start with the new interfaces in the incubator package if we want to put it in incrementally and then promote it at the next major version bump.

As long as we can retain the simplicity and testability then it's worth exploring as an option. 😄

@oharaandrew314
Copy link
Contributor Author

Ok. I'll close this for now then.

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

Successfully merging this pull request may close these issues.

Support WsHandler symmetry
5 participants