rta
Get RTA nonce token
Returns a nonce token for establishing a WebSocket connection to Xbox Live's Real-Time Activity (RTA) service.
What is RTA?
Real-Time Activity is Xbox Live's push notification system that allows you to subscribe to real-time updates for:
- Rich Presence - Live status updates (what game, what activity)
- Party Details - Party membership changes
- Multiplayer Activity - Session join/leave events
- Social Events - Friend list changes
WebSocket Connection
After obtaining the nonce, connect to the RTA WebSocket:
const response = await fetch('https://api.xbl.io/v2/rta', {
headers: { 'X-Authorization': 'YOUR_API_KEY' }
});
const nonce = await response.text();
const socket = new WebSocket(
`wss://rta.xboxlive.com/connect?nonce=${nonce}`,
'rta.xboxlive.com.V2'
);
socket.onopen = () => {
// Subscribe to presence changes for a user
socket.send('[1,0,"https://userpresence.xboxlive.com/users/xuid(2533274792093122)/richpresence"]');
// Subscribe to party details
socket.send('[1,1,"http://sessiondirectory.xboxlive.com/users/xuid(2533274792093122)/partydetails"]');
// Subscribe to multiplayer activity
socket.send('[1,2,"https://multiplayeractivity.xboxlive.com/users/xuid(2533274792093122)"]');
// Subscribe to friend list changes
socket.send('[1,3,"http://social.xboxlive.com/users/xuid(2533274792093122)/friends"]');
};
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('RTA Event:', data);
};
Subscription Message Format
[1, subscriptionId, "resourceUri"]
- 1 - Message type (subscribe)
- subscriptionId - Unique ID for this subscription (use incrementing integers)
- resourceUri - The Xbox Live resource to subscribe to
Common Resource URIs
| Resource | URI Pattern |
|---|---|
| Rich Presence | https://userpresence.xboxlive.com/users/xuid({xuid})/richpresence |
| Party Details | http://sessiondirectory.xboxlive.com/users/xuid({xuid})/partydetails |
| Multiplayer | https://multiplayeractivity.xboxlive.com/users/xuid({xuid}) |
| Friends | http://social.xboxlive.com/users/xuid({xuid})/friends |
get/v2/rta
Response
RTA nonce token for WebSocket connection
Example response
{
"code": 200
}