Enable Server-Side Events (SSE) / Streaming

Hi,

We discussed this earlier here, but the thread was closed:

It was never included in Local, even as an option. Luckily, @austinwendt provided a solution which used to work. Since Local 9.0.2, that doesn’t work anymore and modifying the nginx.conf in /Applications/Local.app/Contents/Resources/extraResources/router-config has no effect anymore.

Any solution to enable SSE? Guys, this is really important, and I believe this should be really enabled by default, or an option should be added for it.

Thanks,
Jordy.

Sorry you ran into this again, @TigrouMeow. For me the workaround you linked to is still working with Local 9.0.2 as long as I make sure any running nginx processes are closed in Activity Monitor before restarting Local:

I made sure nginx processes are terminated:

And confirmed the nginx.conf edit was applied:

> cat /Applications/Local.app/Contents/Resources/extraResources/router-config/nginx.conf | grep proxy_
    proxy_buffer_size         128k;
    proxy_buffers             4 256k;
    proxy_busy_buffers_size   256k;
    proxy_set_header Connection '';
    proxy_http_version 1.1;

This is the result of then restarting Local and running your test script:

SSE shows events per second, not all at once

this is really important, and I believe this should be really enabled by default

We agree. I spoke to the other Local devs and we plan to add those two config lines in an upcoming release. We’re tracking this internally now and I don’t have a timeline (we’ll need to test it for unexpected impact on all OSs Local supports). But I’ll leave this thread open until that work is done.

1 Like

Another thing you could try if the previous workaround still isn’t helping after you kill stray nginx processes:

Replacing this from the nginx.conf:

    proxy_buffering         128k;
    proxy_buffers             4 256k;
    proxy_busy_buffers_size   256k;

With this:

    proxy_buffering         off;