Skip to content

Add SSE annotation support for MVC controllers - #4019

Merged
jknack merged 2 commits into
jooby-project:mainfrom
mylyed:feat/sse-mvc
Oct 24, 2026
Merged

jknack merged 2 commits into
jooby-project:mainfrom
mylyed:feat/sse-mvc

Conversation

@mylyed

@mylyed mylyed commented Oct 21, 2026

Copy link
Copy Markdown

Elegantly utilizing SSE

@SSE("sse")
    public void sse(ServerSentEmitter emitter) {
        emitter.send("Welcome");
        emitter.onClose(() -> {
            // Clean up resources
        });
        emitter.close();
    }

apt

app.sse("/sse", this::sse);

public void sse(io.jooby.ServerSentEmitter emitter) {
      var ctx = emitter.getContext();
      var c = this.factory.apply(ctx);
      c.sse(emitter);
    }

@jknack jknack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, can you add a SseController.kt so we make sure code generator works for Kotlin too?

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.17%. Comparing base (7605c08) to head (f1f3368).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4019      +/-   ##
============================================
- Coverage     94.18%   94.17%   -0.01%     
- Complexity     6653     6654       +1     
============================================
  Files           432      432              
  Lines         20893    20893              
  Branches       2096     2096              
============================================
- Hits          19678    19676       -2     
- Misses          757      762       +5     
+ Partials        458      455       -3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mylyed

mylyed commented Oct 23, 2026

Copy link
Copy Markdown
Author

here
Added Kotlin test cases

f1f3368

@jknack jknack added this to the 4.5.5 milestone Oct 24, 2026
@jknack jknack added the sse label Oct 24, 2026
@jknack
jknack merged commit bce9dd0 into jooby-project:main Oct 24, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants