SDK
SDK Golang v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Count #

Returns the number of other connections sharing the same subscription.

Arguments #

func (r *Realtime) Count(roomID string, options types.QueryOptions) (int, error)

ArgumentsTypeDescription
roomId
string
Subscription room ID
options
types.QueryOptions
Query options

options #

Additional query options

OptionType
(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)
}