Verify if the exist the channel before

This commit is contained in:
claudemiro
2016-01-17 00:12:12 -02:00
parent 403138e28f
commit cbb34a928f
+4 -4
View File
@@ -186,15 +186,15 @@ func onMessage(conn *websocket.Conn, w http.ResponseWriter, r *http.Request, ses
channel, err := app.FindChannelByChannelID(clientEvent.Channel)
if err != nil {
emitWSError(newGenericError(fmt.Sprintf("Could not find a channel with the id %s", clientEvent.Channel)), conn)
}
if !channel.IsPresenceOrPrivate() {
emitWSError(newGenericError("Client event rejected - only supported on private and presence channels"), conn)
break
}
if err != nil {
emitWSError(newGenericError(fmt.Sprintf("Could not find a channel with the id %s", clientEvent.Channel)), conn)
}
if err := app.Publish(channel, clientEvent, sessionID); err != nil {
log.Error(err)
emitWSError(newGenericReconnectImmediatelyError(), conn)