Skip to content

WS Endpoints#92

Open
badnikhil wants to merge 2 commits into
foss42:mainfrom
badnikhil:test-endpoints
Open

WS Endpoints#92
badnikhil wants to merge 2 commits into
foss42:mainfrom
badnikhil:test-endpoints

Conversation

@badnikhil

@badnikhil badnikhil commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

This PR extends the WebSocket endpoints

Endpoint Behavior
/ws/ticker/{interval} Server-push: sends {"type":"ticker","tick":n,"interval":i} every interval seconds (1–60). Out-of-range interval → close 1008. Tests passive receiving / live feeds.
/ws/close/{code} Sends one message, then closes with the requested close code (1000–1003, 1007–1014, 3000–4999) so clients can verify close-code handling. Reserved/invalid codes → close 1008.
/ws/auth Token-gated echo. Authenticate via Authorization: Bearer apidash-test-ws-token header or ?token= query param (browsers can't set WS headers). Missing/invalid → close 1008. Lets clients verify custom handshake headers/params are actually transmitted.
/ws/broadcast Chat-style fan-out: every message is delivered to all connected clients (including sender). Useful for multi-client/multi-tab testing.

Testing

  • pytest tests/ws/ → 16 passed (new tests for ticker timing, close codes,auth accept/reject via header and query, broadcast fan-out across 3 clients,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant