SDK
SDK Golang v3.x
2

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