get
https://{domain}/nbc/players/@me/events
WebSocket Real-Time Events
This is a Socket.IO WebSocket endpoint, not a REST endpoint. This documentation describes the WebSocket protocol.
Connection
Connect using a Socket.IO client to the /events path:
import { io } from "socket.io-client";
const socket = io("https://{domain}/nbc", {
path: "/players/@me/events",
transports: ["websocket", "polling"],
auth: {
bearer: "<player-jwt-token>"
}
});
Authentication
Provide a valid player JWT token in the auth.bearer field during the handshake. Connections without a valid token are rejected with an Unauthorized error.
Events (Server → Client)
| Event | Payload | Description |
|---|---|---|
game.event.update | string (dataType) | Emitted when a game event occurs for the connected player. The payload is the event's dataType string (see examples below). |
dataType values
The dataType payload is a string identifying what happened. Common examples:
| dataType | Trigger |
|---|---|
LEVEL_UP | Player reached a new level |
REWARD_DISTRIBUTED | A reward was given to the player |
QUEST_COMPLETED | Player completed a quest |
QUEST_STARTED | A quest was started for the player |
CHALLENGE_COMPLETED | Player completed a challenge |
CHALLENGE_PROGRESS_UPDATED | Progress on a challenge changed |
PERK_REWARDED | A perk was awarded to the player |
PERK_ACTIVATED | Player activated a perk |
DAILY_CLAIMED | Player claimed a daily bonus |
ACHIEVEMENT_REWARD_CLAIMED | Player claimed an achievement reward |
LEADERBOARD_ROTATED | A leaderboard rotation occurred |
POLL_VOTE_SUBMITTED | Player submitted a poll vote |
ASSIGNMENT_GIVEN | An assignment was given to the player |
ASSIGNMENT_COMPLETED | Player completed an assignment |
USER_CREATED | A new user was created |
Use dataType to decide which parts of the UI to refresh (e.g., re-fetch quests on QUEST_COMPLETED, re-fetch balance on REWARD_DISTRIBUTED).
Example: Listening to events
socket.on("game.event.update", (dataType) => {
switch (dataType) {
case "REWARD_DISTRIBUTED":
refreshBalance();
break;
case "QUEST_COMPLETED":
refreshQuests();
break;
case "LEVEL_UP":
showLevelUpAnimation();
break;
default:
console.log("Event received:", dataType);
}
});
socket.on("connect_error", (err) => {
console.error("Connection failed:", err.message);
});