Skip to content

Live notification socket

GET
/ws/notifications
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.

ticket
required
string

A ticket from POST /api/notifications/ws-ticket. It works once, within 30 seconds.

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.