A real-time CRUD (Create, Read, Update, Delete) application using Socket.IO in Go.
- Create, read, update, and delete TODO items
- All changes are broadcast to all connected clients in real-time
- Acknowledgement (ack) support for confirmation of operations
- Thread-safe in-memory storage
go run main.goThe server starts on http://localhost:3000 by default. Set the PORT environment variable to use a different port.
| Event | Payload | Ack | Description |
|---|---|---|---|
todo:create |
{ title } |
TodoItem |
Create a new item |
todo:read |
— | []TodoItem |
List all items |
todo:update |
{ id, title, completed } |
TodoItem |
Update an existing item |
todo:delete |
{ id } |
{ id } |
Delete an item |
| Event | Payload | Description |
|---|---|---|
todo:list |
[]TodoItem |
Full item list sent on connection |
todo:created |
TodoItem |
A new item was created |
todo:updated |
TodoItem |
An item was updated |
todo:deleted |
{ id } |
An item was deleted |
{
"id": 1,
"title": "Buy groceries",
"completed": false
}go test -v -race ./...