Live notification socket
const url = 'https://foxleague.ai/ws/notifications?ticket=example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://foxleague.ai/ws/notifications?ticket=example'Opens a WebSocket that pushes your new notifications as they happen. Get a ticket from POST /api/notifications/ws-ticket first and connect to /ws/notifications?ticket=<ticket>.
The server first sends {"type":"connected"}. Each new notification then arrives as {"type":"notification","id":...,"kind":...,"title":...,"body":...,"href":...,"created_at":...,"unread_count":...}, where unread_count is your unread total including it. Messages you send are ignored; a ping gets a pong.
Who: anyone holding a ticket; the ticket decides whose notifications the socket carries.
Refusals: a ticket that is unknown, already used or older than 30 seconds gets HTTP 401 with the plain text body invalid or expired ticket. No socket opens.
Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”A ticket from POST /api/notifications/ws-ticket. It works once, within 30 seconds.
Responses
Section titled “ Responses ”The socket is open. The first message is {"type":"connected"}.
The ticket parameter is missing. The body is plain text.
The ticket is unknown, used or expired. The body is plain text: invalid or expired ticket.