Events
Understand the event system for tracking changes in the status and relationships of friends.
阅读时间1 分钟最后更新于 10 个月前
Most relationships don’t change often, but when there are changes, users want to know about them as soon as possible. The Friends SDK fetches all a user's relationships at startup, then keeps the list up-to-date using events.
The SDK sends events as soon as changes occur. User relationship changes that trigger an event include:
- A friend updates their presence status.
- The user adds a new relationship. A user creates a relationship or a
FRIEND_REQUESTis accepted creating aFRIEND_REQUESTrelationship.FRIEND - The user removes a relationship like a , a
FRIEND_REQUEST, or aFRIENDrelationship.BLOCK
You can use callbacks that run in response to notification events to subscribe the current user to notifications.
You can subscribe (and unsubscribe) to the following event types:
Parameter | Description |
|---|---|
| RelationshipAdded | Event invoked when a relationship involving the current user gets added. |
| RelationshipDeleted | Event invoked when a relationship involving the current user gets deleted. |
| PresenceUpdated | Event invoked when the presence of a member associated with the current user updates their presence. |
| MessageReceived | Event invoked when a user sends a message to the current user. |