Skip to content

Add SSE annotation support for MVC controllers - #4019

Open
mylyed wants to merge 1 commit into
jooby-project:mainfrom
mylyed:feat/sse-mvc
Open

mylyed wants to merge 1 commit 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 (6a52a48).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4019      +/-   ##
============================================
- Coverage     94.18%   94.17%   -0.02%     
+ Complexity     6653     6652       -1     
============================================
  Files           432      432              
  Lines         20893    20893              
  Branches       2096     2096              
============================================
- Hits          19678    19675       -3     
- Misses          757      760       +3     
  Partials        458      458              

☔ 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.

This branch has not been deployed

No deployments
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.

2 participants