Skip to content

feat: Adding support for SSE on the WebClient#2794

Merged
tsegismont merged 1 commit intovert-x3:masterfrom
ehsavoie:sse_client
Nov 6, 2025
Merged

feat: Adding support for SSE on the WebClient#2794
tsegismont merged 1 commit intovert-x3:masterfrom
ehsavoie:sse_client

Conversation

@ehsavoie
Copy link
Copy Markdown
Contributor

Motivation:

I needed to be able to process SSE events on the client side.

Conformance:

You should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md
Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines

Copy link
Copy Markdown
Contributor

@vietj vietj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need for now

  • at least 1 integration test with WebClient
  • SseBodyCodec and tests should be in vertx-web-common package instead where BodyCodec is

@ehsavoie ehsavoie force-pushed the sse_client branch 2 times, most recently from 4efdb3b to fdd4b43 Compare September 26, 2025 12:46
Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ehsavoie !

How about moving SseEvent to the common module so that we could, later on, think about sse for the server without breaking things here?

cc @vietj

@ehsavoie
Copy link
Copy Markdown
Contributor Author

@tsegismont maybe I could make the SseEvent toString to acutally create a 'valid'SSE string with the new lines

@ehsavoie ehsavoie force-pushed the sse_client branch 2 times, most recently from b232c03 to fddd3ac Compare October 1, 2025 11:10
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/sse/SseBodyCodec.java Outdated
Comment thread vertx-web-client/src/test/java/io/vertx/ext/web/client/tests/SseClientTest.java Outdated
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/sse/SseBodyCodec.java Outdated
Copy link
Copy Markdown
Contributor

@vietj vietj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes

Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/sse/SseBodyCodec.java Outdated
Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ehsavoie ! This looks great already. I think we need to make the new objects Vert.x API objects (annotated with @VertxGen or @DataObject).

Otherwise, they won't be available in generated bindings.

That might require a bit of refactoring, you can inspire from other codecs, like BodyCodec.

Comment thread vertx-web-client/src/main/asciidoc/index.adoc Outdated
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/sse/SseEvent.java Outdated
@ehsavoie ehsavoie force-pushed the sse_client branch 6 times, most recently from 9274840 to 5164652 Compare October 17, 2025 08:42
Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates @ehsavoie !

Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/SseEvent.java
Comment thread vertx-web-client/src/main/java/examples/WebClientExamples.java Outdated
Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ehsavoie !

Comment thread vertx-web-common/src/test/java/module-info.java Outdated
Comment thread vertx-web-common/pom.xml
Comment thread vertx-web-common/src/main/java/module-info.java
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/SseEvent.java Outdated
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/BodyCodec.java Outdated
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/impl/SseBodyCodec.java Outdated
Comment thread vertx-web-common/src/main/java/io/vertx/ext/web/codec/impl/SseBodyCodec.java Outdated
@tsegismont
Copy link
Copy Markdown
Member

@vietj @ehsavoie do we intend to backport this to 4.x ? I believe we should take this into account while implementing the data object (regarding requirements of data objects like empty/copy/json constructors)

Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for not moving the test from web-common to web-client?

@ehsavoie
Copy link
Copy Markdown
Contributor Author

@tsegismont I've move the test

@ehsavoie ehsavoie requested a review from tsegismont October 24, 2025 16:57
@tsegismont
Copy link
Copy Markdown
Member

@ehsavoie can you please rebase the PR ? Thank you

@ehsavoie
Copy link
Copy Markdown
Contributor Author

ehsavoie commented Nov 6, 2025

@tsegismont rebased

Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ehsavoie , there's just one modification that is no longer required. Can you please revert it? Then we're ready to merge

Comment thread vertx-web-common/src/main/java/module-info.java
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
@ehsavoie
Copy link
Copy Markdown
Contributor Author

ehsavoie commented Nov 6, 2025

@tsegismont everything should be ok now

Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ehsavoie !

@tsegismont tsegismont merged commit 822c9b7 into vert-x3:master Nov 6, 2025
7 checks passed
@tsegismont tsegismont removed the request for review from vietj November 6, 2025 17:13
ehsavoie added a commit to ehsavoie/vertx-web that referenced this pull request Nov 14, 2025
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
ehsavoie added a commit to ehsavoie/vertx-web that referenced this pull request Nov 14, 2025
Bckporting PR (vert-x3#2794) to 5.0.x

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
ehsavoie added a commit to ehsavoie/vertx-web that referenced this pull request Nov 14, 2025
Bckporting PR (vert-x3#2794) to 5.0.x

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
tsegismont pushed a commit that referenced this pull request Nov 17, 2025
Bckporting PR (#2794) to 5.0.x

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants