The channel could be created in the Rest POST Event
This commit is contained in:
@@ -66,13 +66,7 @@ func PostEvents(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range input.Channels {
|
for _, c := range input.Channels {
|
||||||
channel, err := app.FindChannelByChannelID(c)
|
channel := app.FindOrCreateChannelByChannelID(c)
|
||||||
|
|
||||||
// Channel exists?
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, fmt.Sprintf("Could not find a channel with id %s", c), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
app.Publish(channel, RawEvent{Event: input.Name, Channel: c, Data: input.Data}, input.SocketID)
|
app.Publish(channel, RawEvent{Event: input.Name, Channel: c, Data: input.Data}, input.SocketID)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user