koajs / koa.io

[MAINTAINERS WANTED] Realtime web framework combine koa and socket.io.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'add user' emit?

basickarl opened this issue · comments

I don't see in the example how 'add user' is invoked? I was expecting a line of code to state: this.broadcast.emit('add user'...

Nvm found it, socket.emit('add user', username); on the client .js file. I'm guessing server side can't invoke the routes, only via the socket from client side?

Yeah, because it's the client sending a message to the server. The message is sent once the user picks a username.

Thank you for your quick response understand now! :)