Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Raw WebSockets in ASP.NET Core: UseWebSockets, the Receive Loop, the Close Handshake and an Angular Client
With raw WebSockets you must accumulate a message until EndOfMessage with a size limit, write to the socket from a single loop and check Origin yourself. The receive loop, the close handshake, KeepAliveTimeout, a Channel-based send queue, a connection registry, the compression risk, and reconnecting with backoff in Angular using RxJS webSocket().
Real-time Options: Polling, Long Polling, Server-Sent Events, WebSocket and SignalR — Which One When?
Use SSE for one-way notifications, WebSocket or SignalR for two-way low latency, and polling for rarely changing data. We build the same order status feature five ways and measure latency, request count and memory per connection; plus a decision table, where WebTransport stands, and why not everything should be real-time.
System Design Case Study: Chat and Notification System
In a chat system, connections live on stateful gateways while order and storage live in a stateless chat service: a message is stored first, gets a sequence number from a per-conversation server counter, the recipient's gateway is found through presence, and offline recipients get a push. Real output for routing between two gateways with Redis and for ordering, deduplication and gap detection by seq on the client, read receipts, group fan-out and message storage.