mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 10:57:05 +00:00
write a README at the _examples/tutorial/vuejs-todo-mvc mini tutorial, which will be published to other sites soon
Former-commit-id: cee096d0e327b0180bd4ec83d5674729c67b3ddb
This commit is contained in:
@@ -52,6 +52,10 @@ func (c *TodoController) Post(newItems []todo.Item) PostItemResponse {
|
||||
}
|
||||
|
||||
func (c *TodoController) GetSync(conn websocket.Connection) {
|
||||
// join to the session in order to send "saved"
|
||||
// events only to a single user, that means
|
||||
// that if user has opened more than one browser window/tab
|
||||
// of the same session then the changes will be reflected to one another.
|
||||
conn.Join(c.Session.ID())
|
||||
conn.On("save", func() { // "save" event from client.
|
||||
conn.To(c.Session.ID()).Emit("saved", nil) // fire a "saved" event to the rest of the clients w.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Full spec-compliant TodoMVC with Iris
|
||||
// and hash-based routing in ~120 effective lines of JavaScript.
|
||||
// and hash-based routing in ~200 effective lines of JavaScript.
|
||||
|
||||
var socket = new Ws("ws://localhost:8080/todos/sync");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user