Skip to content

Realtime Socket.io Smoke Test Runbook

1. Health endpoint

curl -s http://localhost:3101/api/v1/health/realtime | jq
Expected: pgBridge.connected: true, socketio.namespaces: ["/admin"]

2. Browser connection

Open admin in browser, DevTools Network → WS: Expected: 1 connection to wss://admin.huph.val.id/socket.io/... with 101 Switching Protocols

3. Message realtime

Browser A: open conversation in inbox. Browser B (or WhatsApp): send message to same conversation. Expected: message appears in Browser A within 1 second.

4. End-to-end backend verification

CONV_ID=$(docker exec huph-postgres psql -U huph -d huph -tAc "SELECT id FROM conversations LIMIT 1;")
docker exec huph-postgres psql -U huph -d huph -c "INSERT INTO messages (conversation_id, sender, content) VALUES ('$CONV_ID', 'bot', 'smoke test');"
docker logs huph-api --tail 5 | grep pgBridge
docker exec huph-postgres psql -U huph -d huph -c "DELETE FROM messages WHERE content = 'smoke test';"
Expected log: [pgBridge] event=message.new rooms=2 emitted

5. Reconnect resilience

Restart huph-api container. Browser shows "Reconnecting…" badge then auto-recovers.