Websocket /websocket/{queueID}
Real-time streaming connection that pushes
killmails as they arrive. Best for applications
that need immediate updates. Add
?stream=fast to receive killmails
earlier without the zkb object, see
Fast stream.
import asyncio
import websockets
import json
async def consume_killmails():
# Prefer secure websocket (wss://) but plain websocket (ws://) is available
uri = "wss://killmail.stream/websocket/my-queue-id"
async with websockets.connect(uri) as websocket:
while True:
message = await websocket.recv()
killmail = json.loads(message)
print(f"Killmail: {killmail['killmail_id']}")
asyncio.run(consume_killmails())