Simpler logic
This commit is contained in:
+4
-4
@@ -74,7 +74,10 @@ func (c *channel) Subscribe(a *app, conn *connection, channelData string) error
|
|||||||
subscription := newSubscription(conn, channelData)
|
subscription := newSubscription(conn, channelData)
|
||||||
c.Subscriptions[conn.SocketID] = subscription
|
c.Subscriptions[conn.SocketID] = subscription
|
||||||
|
|
||||||
if c.IsPresence() {
|
if !c.IsPresence() {
|
||||||
|
conn.Publish(newSubscriptionSucceededEvent(c.ChannelID, "{}"))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// User Info Data
|
// User Info Data
|
||||||
var info struct {
|
var info struct {
|
||||||
UserID string `json:"user_id"`
|
UserID string `json:"user_id"`
|
||||||
@@ -116,9 +119,6 @@ func (c *channel) Subscribe(a *app, conn *connection, channelData string) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
conn.Publish(newSubscriptionSucceededEvent(c.ChannelID, string(js)))
|
conn.Publish(newSubscriptionSucceededEvent(c.ChannelID, string(js)))
|
||||||
} else {
|
|
||||||
conn.Publish(newSubscriptionSucceededEvent(c.ChannelID, "{}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// WebHook
|
// WebHook
|
||||||
if c.TotalSubscriptions() == 1 {
|
if c.TotalSubscriptions() == 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user