Unsubscribe

Removes a subscription.

Arguments

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

Return an error is something was wrong.

Usage

Copied to clipboard!
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")
}