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) {
141141
142142 @ Override
143143 protected void hookOnNext (String line ) {
144-
145144 if (line .isEmpty ()) {
146145 // Empty line means end of event
147146 if (this .eventBuilder .length () > 0 ) {
@@ -158,23 +157,27 @@ protected void hookOnNext(String line) {
158157 if (matcher .find ()) {
159158 this .eventBuilder .append (matcher .group (1 ).trim ()).append ("\n " );
160159 }
160+ upstream ().request (1 );
161161 }
162162 else if (line .startsWith ("id:" )) {
163163 var matcher = EVENT_ID_PATTERN .matcher (line );
164164 if (matcher .find ()) {
165165 this .currentEventId .set (matcher .group (1 ).trim ());
166166 }
167+ upstream ().request (1 );
167168 }
168169 else if (line .startsWith ("event:" )) {
169170 var matcher = EVENT_TYPE_PATTERN .matcher (line );
170171 if (matcher .find ()) {
171172 this .currentEventType .set (matcher .group (1 ).trim ());
172173 }
174+ upstream ().request (1 );
173175 }
174176 else if (line .startsWith (":" )) {
175177 // Ignore comment lines starting with ":"
176178 // This is a no-op, just to skip comments
177179 logger .debug ("Ignoring comment line: {}" , line );
180+ upstream ().request (1 );
178181 }
179182 else {
180183 // If the response is not successful, emit an error
You can’t perform that action at this time.
0 commit comments