Simpler logic

This commit is contained in:
claudemiro
2016-09-01 23:42:18 -03:00
parent 9d732fb01a
commit 8fb96f3cbf
+4 -4
View File
@@ -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 {