mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
minor example fixes
Former-commit-id: 163652ddfad00300590fbe6798cf9761a8e4b5e6
This commit is contained in:
parent
450f20902d
commit
2567ed22be
|
@ -86,12 +86,12 @@ func (c *websocketController) OnNamespaceConnected(msg neffos.Message) error {
|
|||
// visits++
|
||||
newCount := increment()
|
||||
|
||||
// This will call the "OnVisit" event on all clients, including the current
|
||||
// This will call the "OnVisit" event on all clients, including the current one,
|
||||
// with the 'newCount' variable.
|
||||
//
|
||||
// There are many ways that u can do it and faster, for example u can just send a new visitor
|
||||
// and client can increment itself, but here we are just "showcasing" the websocket controller.
|
||||
c.Conn.Server().Broadcast(c, neffos.Message{
|
||||
c.Conn.Server().Broadcast(nil, neffos.Message{
|
||||
Namespace: msg.Namespace,
|
||||
Event: "OnVisit",
|
||||
Body: []byte(fmt.Sprintf("%d", newCount)),
|
||||
|
|
|
@ -68,7 +68,7 @@ func main() {
|
|||
|
||||
// serves the endpoint of ws://localhost:8080/echo
|
||||
websocketRoute := app.Get("/echo", websocket.Handler(websocketServer))
|
||||
j.Get()
|
||||
|
||||
if enableJWT {
|
||||
// Register the jwt middleware (on handshake):
|
||||
websocketRoute.Use(j.Serve)
|
||||
|
|
Loading…
Reference in New Issue
Block a user