SDK
SDK Golang v3.x
2

Unsubscribe #

Removes a subscription.

Arguments #

func (r *Realtime) Unsubscribe(roomID string, options types.QueryOptions) 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 #

Return an error is something was wrong.

Usage #

filters := json.RawMessage(`{}`)
listener := make(chan types.NotificationResult)
go func() {
  <-listener
}()
res, err := kuzzle.Realtime.Subscribe(
  "nyc-open-data",
  "yellow-taxi",
  filters,
  listener,
  nil)
if err != nil {
  log.Fatal(err)
}
err = kuzzle.Realtime.Unsubscribe(res.Room, nil)
if err != nil {
  log.Fatal(err)
} else {
  fmt.Println("Success")
}