39 lines
485 B
Markdown
39 lines
485 B
Markdown
---
|
|
title: WebSockets for Live Updates
|
|
date: 10-11-2025
|
|
last_modified: 11-11-2025:15:27
|
|
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
|
|
}
|
|
```
|
|
|
|
lfkfdkfd dd |