File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -170,12 +170,6 @@ export const proxyServer = async ({
170
170
*/
171
171
const startSending = async ( transport : SSEServerTransport ) => {
172
172
try {
173
- await transport . send ( {
174
- jsonrpc : "2.0" ,
175
- method : "sse/connection" ,
176
- params : { message : "SSE Connection established" } ,
177
- } ) ;
178
-
179
173
let messageCount = 0 ;
180
174
const interval = setInterval ( async ( ) => {
181
175
messageCount ++ ;
@@ -249,6 +243,14 @@ export const startSSEServer = async ({
249
243
250
244
await server . connect ( transport ) ;
251
245
246
+ await transport . send ( {
247
+ jsonrpc : "2.0" ,
248
+ method : "sse/connection" ,
249
+ params : { message : "SSE Connection established" } ,
250
+ } ) ;
251
+
252
+ onConnect ?.( server ) ;
253
+
252
254
res . on ( "close" , ( ) => {
253
255
console . log ( "SSE connection closed" ) ;
254
256
@@ -257,9 +259,7 @@ export const startSSEServer = async ({
257
259
onClose ?.( server ) ;
258
260
} ) ;
259
261
260
- startSending ( transport ) . then ( ( ) => {
261
- onConnect ?.( server ) ;
262
- } ) ;
262
+ startSending ( transport ) ;
263
263
264
264
return ;
265
265
}
You can’t perform that action at this time.
0 commit comments