Tags: Models, Call methods, Client subscriptions
A simple text field that can be edited by multiple clients simultaneously.
git clone https://github.com/jirenius/go-res
cd go-res/examples/02-edit-text
go run .
Open the client
http://localhost:8082
- Open the client in two separate tabs.
- Edit the message in one tab, and observe realtime updates in both.
- Stop the service.
- Edit the default text (
"Hello, Go World!"
) in main.go. - Restart the service to observe resetting of the message in all clients.
Request | Resource | Description |
---|---|---|
get | text.shared |
Simple model. |
call | text.shared.set |
Sets the model's message property. |
Resources can be retrieved using ordinary HTTP GET requests, and methods can be called using HTTP POST requests.
GET http://localhost:8080/api/text/shared
POST http://localhost:8080/api/text/shared/set
Body
{ "message": "Updated through HTTP" }