Count #
Returns the number of other connections sharing the same subscription.
Arguments #
func (r *Realtime) Count(roomID string, options types.QueryOptions) (int, error)
Arguments | Type | Description |
---|---|---|
roomId | string | Subscription room ID |
options | types.QueryOptions | Query options |
options #
Additional query options
Option | Type (default) | Description |
---|---|---|
queuable | bool ( true ) | Make this request queuable or not |
Return #
Returns the number of active connections using the same provided subscription room.
Usage #
filters := json.RawMessage(`{}`)
listener := make(chan types.NotificationResult)
go func() {
<-listener
}()
res, _ := kuzzle.Realtime.Subscribe(
"nyc-open-data",
"yellow-taxi",
filters,
listener,
nil)
count, err := kuzzle.Realtime.Count(res.Room, nil)
if err != nil {
log.Fatal(err)
} else {
fmt.Printf("Currently %d active subscription\n", count)
}
Edit this page on Github(opens new window)