minor example fixes

Former-commit-id: 163652ddfad00300590fbe6798cf9761a8e4b5e6
This commit is contained in:
Gerasimos (Makis) Maropoulos 2019-07-09 12:25:06 +03:00
parent 450f20902d
commit 2567ed22be
2 changed files with 3 additions and 3 deletions

View File

@ -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)),

View File

@ -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)