Open a WebSocket that pushes a stock tick every second
GET
wss://api.testingapis.com/ws/tickerEach message is {"type":"tick","data":{...}}. After the last tick the server sends {"type":"complete"} and closes with 1000 "Ticker finished". Closing from the client stops the ticker early.
Swagger UI cannot open WebSockets. Use a WebSocket client instead:``wscat -c "wss://api.testingapis.com/ws/ticker?count=10"
Parameters 1
| Name | Type | Description |
|---|---|---|
count | query · integer (int32) | Number of ticks before the server closes (1-300, default 30). Default: 30. |
Responses
- 200
- OK
- 101
- Switching Protocols: the WebSocket is open.
- 400
- The request was plain HTTP rather than a WebSocket upgrade.
Example
Request
curl -X GET "https://api.testingapis.com/ws/ticker?count=3"Response
WebSocket. Connect with ws://{host}/ws/ticker?count=3. The server pushes one JSON tick per second, then a completion message and a normal close.
< {"type":"tick","seq":1,"symbol":"APIB","price":101.25,…}
< {"type":"tick","seq":2,…}
< {"type":"complete","ticks":3}