Question

I see a lot of callback functions accept a parameter referred to as context in the GoInstant documentation, but it's not clear what this parameter is or what it's used for.

Était-ce utile?

La solution

The context parameter contains meta-data about the event.

The full docs are here: https://developers.goinstant.net/v1/key/context.html

It includes:

  • the type of command (SET, GET, etc.)
  • the name of the key
  • the value of the key after the operation
  • the room to which the key belongs
  • the user that instantiated the action
  • a local boolean used to indicate whether the change was triggered locally or remotely
  • and a bubble boolean used to indicate whether the event was triggered from this key or a child key.

It can be useful to understand where and why you are receiving the event.

Disclosure: I work at GoInstant.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top