You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I would like to suggest adding first-class support for Server-Sent Events (SSE) in Laravel.
Currently, Laravel provides excellent support for real-time communication through broadcasting (e.g., Pusher, Ably, WebSockets). However, there is no simple, built-in way to stream one-way events from the server to the client using the standard [EventSource API](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).
SSE is a lightweight alternative to WebSockets for many real-time use cases, such as:
Progress updates for long-running tasks
Live logs or system monitoring dashboards
Notifications or status updates that don’t require bi-directional communication
Why SSE?
Native to browsers: The EventSource API is supported by most modern browsers without extra dependencies.
Simpler than WebSockets: SSE works over standard HTTP, does not require an additional server or library, and scales well with Laravel’s existing request/response lifecycle.
Complementary to Broadcasting: Not all apps need WebSockets; sometimes a simple one-way stream is enough.
Proposed API
A possible way to expose SSE in Laravel could be through a SseResponse (similar to StreamedResponse):
Conclusion
This feature would give Laravel developers an easy, framework-native way to use SSE without relying on manual implementations of StreamedResponse or third-party packages. It aligns with Laravel’s goal of making common web tasks elegant and expressive.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I would like to suggest adding first-class support for Server-Sent Events (SSE) in Laravel.
Currently, Laravel provides excellent support for real-time communication through broadcasting (e.g., Pusher, Ably, WebSockets). However, there is no simple, built-in way to stream one-way events from the server to the client using the standard [EventSource API](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).
SSE is a lightweight alternative to WebSockets for many real-time use cases, such as:
Why SSE?
EventSource
API is supported by most modern browsers without extra dependencies.Proposed API
A possible way to expose SSE in Laravel could be through a
SseResponse
(similar toStreamedResponse
):The response helper (
Response::sse
) could handle:Content-Type: text/event-stream
,Cache-Control: no-cache
)id
,event
,data
)Example Client Usage
Conclusion
This feature would give Laravel developers an easy, framework-native way to use SSE without relying on manual implementations of
StreamedResponse
or third-party packages. It aligns with Laravel’s goal of making common web tasks elegant and expressive.Beta Was this translation helpful? Give feedback.
All reactions