mirror of
https://github.com/kataras/iris.git
synced 2025-02-09 02:34:55 +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++
|
// visits++
|
||||||
newCount := increment()
|
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.
|
// with the 'newCount' variable.
|
||||||
//
|
//
|
||||||
// There are many ways that u can do it and faster, for example u can just send a new visitor
|
// 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.
|
// 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,
|
Namespace: msg.Namespace,
|
||||||
Event: "OnVisit",
|
Event: "OnVisit",
|
||||||
Body: []byte(fmt.Sprintf("%d", newCount)),
|
Body: []byte(fmt.Sprintf("%d", newCount)),
|
||||||
|
|
|
@ -68,7 +68,7 @@ func main() {
|
||||||
|
|
||||||
// serves the endpoint of ws://localhost:8080/echo
|
// serves the endpoint of ws://localhost:8080/echo
|
||||||
websocketRoute := app.Get("/echo", websocket.Handler(websocketServer))
|
websocketRoute := app.Get("/echo", websocket.Handler(websocketServer))
|
||||||
j.Get()
|
|
||||||
if enableJWT {
|
if enableJWT {
|
||||||
// Register the jwt middleware (on handshake):
|
// Register the jwt middleware (on handshake):
|
||||||
websocketRoute.Use(j.Serve)
|
websocketRoute.Use(j.Serve)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user