SSE connection
Withcable, SSE is very easy to implement. You simply write data-sse=“[endpoint]” and event data-event=“[event-name]” and it will automatically create an SSE connection instance. This SSE only requires Briz.js.
Example
<div data-sse="/api/sse" data-event="update">
<h1 data-swap="res">...waiting response</h1>
</div>
With just a few lines of code above, developers can create a cheap, lightweight real-time connection that automatically reconnects when a connection error occurs. Keep in mind that SSE only handles single-path real-time connections, from server to client. If a two-path connection is required, it’s better to use WebSockets. However, in many cases, SSE is sufficient for real-time applications such as notifications, real-time dashboard data, etc.
Demo
...waiting response
Go back