35 lines
471 B
Markdown
35 lines
471 B
Markdown
---
|
|
title: "WebSockets for Live Updates"
|
|
date: "10-11-2025"
|
|
last_modified: "10-11-2025:19:21"
|
|
tags: ["research", "tech", "websocket"]
|
|
---
|
|
|
|
# WebSockets
|
|
|
|
## Use Cases
|
|
|
|
- Live file tree updates
|
|
- Real-time collaboration
|
|
- Presence indicators
|
|
|
|
## Libraries
|
|
|
|
- `gorilla/websocket`
|
|
- `nhooyr.io/websocket`
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Client <-> WebSocket <-> Hub <-> Indexer
|
|
```
|
|
|
|
## Broadcasting
|
|
|
|
```go
|
|
type Hub struct {
|
|
clients map[*Client]bool
|
|
broadcast chan []byte
|
|
}
|
|
```
|