FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: handle SSE comment messages by tzolov · Pull Request #467 · modelcontextprotocol/java-sdk · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import org.reactivestreams.FlowAdapters;
import org.reactivestreams.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.modelcontextprotocol.spec.McpError;
import reactor.core.publisher.BaseSubscriber;
Expand All @@ -31,6 +33,8 @@
*/
class ResponseSubscribers {

private static final Logger logger = LoggerFactory.getLogger(ResponseSubscribers.class);

record SseEvent(String id, String event, String data) {
}

Expand Down Expand Up @@ -167,6 +171,11 @@ else if (line.startsWith("event:")) {
this.currentEventType.set(matcher.group(1).trim());
}
}
else if (line.startsWith(":")) {
// Ignore comment lines starting with ":"
// This is a no-op, just to skip comments
logger.debug("Ignoring comment line: {}", line);
}
else {
// If the response is not successful, emit an error
// TODO: This should be a McpTransportError
Expand Down

Back | FazBrowse Home | New Git URL