Added util method IsClientEvent
This commit is contained in:
+1
-2
@@ -7,7 +7,6 @@ package ipe
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -215,7 +214,7 @@ func (c *channel) Publish(a *app, event rawEvent, ignore string) error {
|
||||
subs.Connection.Publish(newResponseEvent(event.Event, event.Channel, v))
|
||||
} else {
|
||||
// Webhook
|
||||
if strings.HasPrefix(event.Event, "client-") {
|
||||
if utils.IsClientEvent(event.Event) {
|
||||
a.TriggerClientEventHook(c, subs, event.Event, v)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ func onMessage(conn *websocket.Conn, w http.ResponseWriter, r *http.Request, ses
|
||||
}
|
||||
default: // CLient Events ??
|
||||
// see http://pusher.com/docs/client_api_guide/client_events#trigger-events
|
||||
if strings.HasPrefix(event.Event, "client-") {
|
||||
if utils.IsClientEvent(event.Event) {
|
||||
if !app.UserEvents {
|
||||
emitWSError(newGenericError("To send client events, you must enable this feature in the Settings."), conn)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user