@@ -124,23 +124,12 @@ public function jsonp($callback, $data = [], $status = 200, array $headers = [],
124124     * 
125125     * @param  \Closure  $callback 
126126     * @param  array  $headers 
127-      * @param  string  $as 
128-      * @param  string|null  $startStreamWith 
129-      * @param  string|null  $endStreamWith 
127+      * @param  string  $endStreamWith 
130128     * @return \Symfony\Component\HttpFoundation\StreamedResponse 
131129     */ 
132-     public  function  eventStream (Closure $ callbackarray  $ headersstring  $ as  =  ' update ' , ? string   $ startStreamWith  =  null , ? string   $ endStreamWith'</stream> ' )
130+     public  function  eventStream (Closure $ callbackarray  $ headersstring  $ endStreamWith'</stream> ' )
133131    {
134-         return  $ this stream (function  () use  ($ callback$ as$ startStreamWith$ endStreamWith
135-             if  (filled ($ startStreamWith
136-                 echo  "event:  $ as ;
137-                 echo  'data:  ' .$ startStreamWith
138-                 echo  "\n\n" ;
139- 
140-                 ob_flush ();
141-                 flush ();
142-             }
143- 
132+         return  $ this stream (function  () use  ($ callback$ endStreamWith
144133            foreach  ($ callbackas  $ message
145134                if  (connection_aborted ()) {
146135                    break ;
@@ -150,22 +139,20 @@ public function eventStream(Closure $callback, array $headers = [], string $as =
150139                    $ messageencode ($ message
151140                }
152141
153-                 echo  "event:  $ as  ;
142+                 echo  "event: update  \n" ;
154143                echo  'data:  ' .$ message
155144                echo  "\n\n" ;
156145
157146                ob_flush ();
158147                flush ();
159148            }
160149
161-             if  (filled ($ endStreamWith
162-                 echo  "event:  $ as ;
163-                 echo  'data:  ' .$ endStreamWith
164-                 echo  "\n\n" ;
150+             echo  "event: update \n" ;
151+             echo  'data:  ' .$ endStreamWith
152+             echo  "\n\n" ;
165153
166-                 ob_flush ();
167-                 flush ();
168-             }
154+             ob_flush ();
155+             flush ();
169156        }, 200 , array_merge ($ headers
170157            'Content-Type '  => 'text/event-stream ' ,
171158            'Cache-Control '  => 'no-cache ' ,
0 commit comments