This directory contains example applications demonstrating the collaborative features of Go Echo LiveView.
A basic kanban board with drag-and-drop functionality.
cd kanban_simple
go run main.go
# Open http://localhost:8080Features:
- Drag and drop cards between columns
- Add new cards
- Filter and search
- Real-time updates
Full-featured project management application with multiple boards.
cd kanban_app
go run main.go
# Open http://localhost:8080Features:
- Multiple project boards
- User assignments
- Comments and attachments
- Priority levels
- WIP limits
Real-time collaborative drawing application.
cd collaborative_canvas
go run main.go
# Open http://localhost:8080Features:
- Multi-user drawing
- Shape tools
- Color selection
- Export to image
Demonstrates all collaborative components in one application.
cd collaborative_demo
go run main.go
# Open http://localhost:8080Features:
- Canvas drawing
- Kanban boards
- Text editor
- Chat room
- Presence indicators
All examples require the WASM module to be built:
# From project root
cd cmd/wasm/
GOOS=js GOARCH=wasm go build -o ../../assets/json.wasmEach collaborative session creates a "room" where multiple users can interact:
room := liveview.GetCollaborationHub().CreateRoom("room_id", "Room Name")Track active users and their activities:
participant := room.Join(userID, userName, driver)Automatically sync state changes across all participants:
room.UpdateSharedState(userID, "action", data)Changes are broadcast to all connected users instantly via WebSockets.
┌─────────────┐ WebSocket ┌─────────────┐
│ Browser │◄──────────────────►│ Server │
│ │ │ │
│ - Canvas │ │ - Room Mgmt │
│ - Kanban │ Events │ - State │
│ - Editor │◄──────────────────►│ - Broadcast │
└─────────────┘ └─────────────┘
▲ ▲
│ │
└──────── WASM Module ──────────────┘
- Embed
CollaborativeComponent:
type MyComponent struct {
*liveview.ComponentDriver[*MyComponent]
*liveview.CollaborativeComponent
// Your fields
}- Initialize collaboration:
func (c *MyComponent) Start() {
c.CollaborativeComponent = &liveview.CollaborativeComponent{
Driver: c.ComponentDriver,
}
c.StartCollaboration("room_id", "user_id", "User Name")
}- Broadcast changes:
c.BroadcastAction("action_name", data)- Handle remote updates:
func (c *MyComponent) HandleRemoteUpdate(data interface{}) {
// Process updates from other users
}You can run multiple examples on different ports:
# Terminal 1
cd kanban_simple
go run main.go
# Terminal 2
cd collaborative_canvas
PORT=8081 go run main.go
# Terminal 3
cd collaborative_demo
PORT=8082 go run main.goFor more information about the LiveView framework and collaborative features, see:
Feel free to create new examples demonstrating different use cases for collaborative components!