Buddy4all: Difference between revisions
| (11 intermediate revisions by the same user not shown) | |||
| Line 12: | Line 12: | ||
=== Friendship endpoints === | === Friendship endpoints === | ||
==== When new friendship request has been made === | ==== When new friendship request has been made ==== | ||
Channel: Websocket and Firebase | |||
Socket message: | |||
<pre> | |||
{ | |||
message: "friendship status changed", | |||
message_type: "api_friendship_status", | |||
status: "new_request",. | |||
friend_id: [:id of the inviting user:], | |||
open_requests: [:# of open friendship requests:], | |||
} | |||
</pre> | |||
==== When new friendship request has been canceled ==== | |||
Channel: Websocket only | |||
Socket message: | |||
<pre> | |||
{ | |||
message: "friendship status changed", | |||
message_type: "api_friendship_status", | |||
status: "canceled",. | |||
friend_id: [:id of the inviting user:], | |||
open_requests: [:# of open friendship requests:], | |||
} | |||
</pre> | |||
==== When a friendship as been accepted ==== | |||
Sent when a friendship request has been accepted, a message is sent to the creator of the request | |||
Channel: Websocket only | |||
Message: | |||
<pre> | |||
{ | |||
message: "friendship status changed", | |||
message_type: "api_friendship_status", | |||
status: "accepted",. | |||
friend_id: [:id of the invited user:], | |||
open_requests: [:# of open friendship requests:], | |||
} | |||
</pre> | |||
==== When a friendship request as been rejected ==== | |||
Sent when a friendship request has been rejected, a message is sent to the creator of the request | |||
Channel: Websocket only | |||
Message: | |||
<pre> | |||
{ | |||
message: "friendship status changed", | |||
message_type: "api_friendship_status", | |||
status: "rejected",. | |||
friend_id: [:id of the invited user:], | |||
open_requests: [:# of open friendship requests:], | |||
} | |||
</pre> | |||
==== When a friendship has been terminated by one of the users ==== | |||
Channel: Websocket only | |||
Message: | Message: | ||
<pre> | <pre> | ||
{ | |||
message: "friendship status changed", | |||
message_type: "api_friendship_status", | |||
status: "terminated",. | |||
friend_id: [:id of the invited user:], | |||
open_requests: [:# of open friendship requests:], | |||
} | |||
</pre> | |||
=== Games endpoints === | |||
==== Notify users when a game sessions between two users the status has changed ==== | |||
The message is sent to both users. | |||
Channel: Websocket only | |||
Websocket message: | |||
<pre> | |||
{ | |||
message_type: "api_game_session_status", | |||
session_id: [:id of the session:], | |||
game_id: [:id of the game:], | |||
user_id: [:id of the user who created the session, partner_id: [:id of the other user:], | |||
state: requested|accepted|rejected|started|finished|canceled|resumed, | |||
game_level: [:current level of the game:], | |||
scheduled_at: [:date when the game is scheduled:], | |||
} | |||
</pre> | |||
=== Posts endpoints === | |||
==== When a new messages was created in the chat ==== | |||
The notification is sent to the user the message was written for. | |||
Channels: Websocket and Firebase | |||
Websocket message: | |||
<pre> | |||
{ | |||
message: "the message", | |||
thread: [:the thread:], | |||
message_type: 'api_chat_message', | |||
} | |||
</pre> | |||
=== OpenVidu Endpoints === | |||
==== Video call status change ==== | |||
Video Call status messages are sent whenever the state of the session changes. The following states are implemented: | |||
* requested | |||
* rejected | |||
* accepted | |||
* terminated | |||
* user_not_available | |||
* pending | |||
* scheduled | |||
Channel: Websocket and Firebase | |||
Websocket message: | |||
<pre> | |||
{ | |||
message_type: 'openvidu_status', | |||
message: 'openvidu_session_status_changed', | |||
status: [:the status:], | |||
friend_id: [:id of the other user:], | |||
session_id: [:id of the openvidu session:], | |||
call_id' => [:internal id of the call:], | |||
} | |||
</pre> | </pre> | ||
Latest revision as of 10:54, 6 October 2023
Introduction
User's Guide
Developers Guide
Notification messages
Notifications are sent by the backend via Websocket and/or Firebase push notifications. The following notification are sent:
Friendship endpoints
When new friendship request has been made
Channel: Websocket and Firebase
Socket message:
{
message: "friendship status changed",
message_type: "api_friendship_status",
status: "new_request",.
friend_id: [:id of the inviting user:],
open_requests: [:# of open friendship requests:],
}
When new friendship request has been canceled
Channel: Websocket only
Socket message:
{
message: "friendship status changed",
message_type: "api_friendship_status",
status: "canceled",.
friend_id: [:id of the inviting user:],
open_requests: [:# of open friendship requests:],
}
When a friendship as been accepted
Sent when a friendship request has been accepted, a message is sent to the creator of the request
Channel: Websocket only
Message:
{
message: "friendship status changed",
message_type: "api_friendship_status",
status: "accepted",.
friend_id: [:id of the invited user:],
open_requests: [:# of open friendship requests:],
}
When a friendship request as been rejected
Sent when a friendship request has been rejected, a message is sent to the creator of the request
Channel: Websocket only
Message:
{
message: "friendship status changed",
message_type: "api_friendship_status",
status: "rejected",.
friend_id: [:id of the invited user:],
open_requests: [:# of open friendship requests:],
}
When a friendship has been terminated by one of the users
Channel: Websocket only
Message:
{
message: "friendship status changed",
message_type: "api_friendship_status",
status: "terminated",.
friend_id: [:id of the invited user:],
open_requests: [:# of open friendship requests:],
}
Games endpoints
Notify users when a game sessions between two users the status has changed
The message is sent to both users.
Channel: Websocket only
Websocket message:
{
message_type: "api_game_session_status",
session_id: [:id of the session:],
game_id: [:id of the game:],
user_id: [:id of the user who created the session, partner_id: [:id of the other user:],
state: requested|accepted|rejected|started|finished|canceled|resumed,
game_level: [:current level of the game:],
scheduled_at: [:date when the game is scheduled:],
}
Posts endpoints
When a new messages was created in the chat
The notification is sent to the user the message was written for.
Channels: Websocket and Firebase
Websocket message:
{
message: "the message",
thread: [:the thread:],
message_type: 'api_chat_message',
}
OpenVidu Endpoints
Video call status change
Video Call status messages are sent whenever the state of the session changes. The following states are implemented:
- requested
- rejected
- accepted
- terminated
- user_not_available
- pending
- scheduled
Channel: Websocket and Firebase
Websocket message:
{
message_type: 'openvidu_status',
message: 'openvidu_session_status_changed',
status: [:the status:],
friend_id: [:id of the other user:],
session_id: [:id of the openvidu session:],
call_id' => [:internal id of the call:],
}
