title: How to get Firefox respect SSE retry time in short intervals?
body: <p>I want <strong>server-sent event</strong> updates every 100 ms, and this works for Chrome and Edge, but not for Firefox, unless I use some other method. But perhaps this can be overcome in Firefox too?</p>
  <p>Normally the method would be (see the code) sse100.html + sse100.php. And Firefox really respects the &quot;retry&quot; field, however only to about &gt;500ms. To get it working &lt;500ms, I could use something like setInterval() and it really works, but this means new EventSource has to be created every time, which kind of makes using SSE obsolete (right?). Am I doing something wrong? Is this sse100.html + sse100.php or some deviation of that working for you in Firefox? Or is this perhaps something that is decided for Firefox, to prevent ? Maybe it could get faster if you would get some action or permission from the user?</p>
  <p>(This is for a game where you could also be a passive spectator and watch how other players' positions are changing, and it's like one move per 200ms, so SSE seems optimal for that, and game ticks would be implemented as SSE.)</p>
  <p>sse100.html:</p>
  <pre><code>&lt;script&gt;
  var source = new EventSource(&quot;sse100.php&quot;);
  source.addEventListener('message', (event) =&gt; { 
  document.getElementById(&quot;result&quot;).innerHTML += event.data + &quot;&lt;br&gt;&quot;;
  });
  &lt;/script&gt;
  &lt;p id=&quot;result&quot;&gt;&lt;/p&gt;
  </code></pre>
  <p>sseinterval.html:</p>
  <pre><code>&lt;script&gt;
  setInterval(() =&gt; {
  
  var source = new EventSource(&quot;sseinterval.php&quot;);
  source.addEventListener('message', (event) =&gt; { 
  document.getElementById(&quot;result&quot;).innerHTML += event.data + &quot;&lt;br&gt;&quot;;
  });
  
  }, 100);
  &lt;/script&gt;
  &lt;p id=&quot;result&quot;&gt;&lt;/p&gt;
  </code></pre>
  <p>sse100.php:</p>
  <pre><code>&lt;?php
  header(&quot;Content-Type: text/event-stream&quot;);
  $curDate = date_create()-&gt;format(&quot;Y-m-d H:i:s.v&quot;);
  echo &quot;event: message\n&quot;;
  echo &quot;data: &quot; . $curDate . &quot; \n\n&quot;;
  
  echo &quot;retry: 100\n\n&quot;;
  
  flush();
  </code></pre>
  <p>sseinterval.php:</p>
  <pre><code>&lt;?php
  header(&quot;Content-Type: text/event-stream&quot;);
  $curDate = date_create()-&gt;format(&quot;Y-m-d H:i:s.v&quot;);
  echo &quot;event: message\n&quot;;
  echo &quot;data: &quot; . $curDate . &quot; \n\n&quot;;
  flush();
  </code></pre>