From his first code I'll assume he's calling the http alias and then immediately trying to message the channel. It doesn't work like that, none of the socket events have run at that point.