SDK
SDK Golang v2.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.

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