File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
mcp/src/main/java/io/modelcontextprotocol/client/transport Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,6 @@ protected void hookOnSubscribe(Subscription subscription) {
141
141
142
142
@ Override
143
143
protected void hookOnNext (String line ) {
144
-
145
144
if (line .isEmpty ()) {
146
145
// Empty line means end of event
147
146
if (this .eventBuilder .length () > 0 ) {
@@ -158,23 +157,27 @@ protected void hookOnNext(String line) {
158
157
if (matcher .find ()) {
159
158
this .eventBuilder .append (matcher .group (1 ).trim ()).append ("\n " );
160
159
}
160
+ upstream ().request (1 );
161
161
}
162
162
else if (line .startsWith ("id:" )) {
163
163
var matcher = EVENT_ID_PATTERN .matcher (line );
164
164
if (matcher .find ()) {
165
165
this .currentEventId .set (matcher .group (1 ).trim ());
166
166
}
167
+ upstream ().request (1 );
167
168
}
168
169
else if (line .startsWith ("event:" )) {
169
170
var matcher = EVENT_TYPE_PATTERN .matcher (line );
170
171
if (matcher .find ()) {
171
172
this .currentEventType .set (matcher .group (1 ).trim ());
172
173
}
174
+ upstream ().request (1 );
173
175
}
174
176
else if (line .startsWith (":" )) {
175
177
// Ignore comment lines starting with ":"
176
178
// This is a no-op, just to skip comments
177
179
logger .debug ("Ignoring comment line: {}" , line );
180
+ upstream ().request (1 );
178
181
}
179
182
else {
180
183
// If the response is not successful, emit an error
You can’t perform that action at this time.
0 commit comments