Member-only story

How I Built a Chat App Without WebSockets

Aziz Fikri Mahmudi
3 min read2 days ago

--

WebSockets VS SSE (Server Sent Events)

Link for non-member: https://tinyurl.com/yp87wur6

Have you ever wondered if it’s possible to create a chat application without using WebSockets? WebSockets are great, but let’s be honest — they can be a pain to implement and maintain properly. Managing connections, handling reconnections, and scaling WebSocket servers can introduce unexpected complexity.

Let me introduce you to SSE (Server-Sent Events) — a simpler alternative that enables real-time updates from the server to the client without the complexity of WebSockets. If you’re under pressure to deliver a chat feature within a tight deadline, SSE might be the perfect solution.

What Is SSE?

SSE, or Server-Sent Events, is a mechanism where a client receives a continuous stream of updates from a server until either side disconnects. The concept of SSE was introduced in 2004 and was first implemented by Opera in 2006. Unlike WebSockets, which provide full-duplex communication (both client and server can send messages), SSE is unidirectional — meaning only the server can push updates to the client.

Why Use SSE for a Chat App?

You might be wondering, if SSE is one-way, how can it work for chat? The trick is simple: we use traditional HTTP requests for sending messages and…

--

--

Aziz Fikri Mahmudi
Aziz Fikri Mahmudi

Written by Aziz Fikri Mahmudi

Passionate Software Engineer | Software Engineer II at Jurnal by Mekari

No responses yet