๐ How to Test WebSocket SOS Service
1. ๐ Step 1: Authenticate
- Go to Authentication tab
- Enter credentials (default: wstester@test.com / WsTest1234!)
- Click Login
- You should see a JWT token in the Token Info panel
2. ๐ก Step 2: Connect WebSocket
- Go to WebSocket tab
- Click Connect button
- You should see connection status change to "Connected"
- Green indicator means WebSocket is active
3. ๐ Step 3: Test Ping/Pong
- Click Send Ping button
- Watch for pong response in the message log
- Latency should be < 100ms
4. ๐จ Step 4: Create SOS Alert
- Go to SOS Alert tab
- Fill in location (latitude/longitude)
- Enter message
- Click Create SOS Alert
- Check WebSocket Messages Log for alert notification
5. ๐ Step 5: Monitor Results
- Go to Monitor tab
- View connection status, message count, and uptime
- Check performance metrics (latency, success rate)
โน๏ธ
Default Test Credentials:
Email: wstester@test.com
Password: WsTest1234!
๐ง API Endpoints
POST /api/v1/auth/login
Content-Type: application/json
{
"email": "wstester@test.com",
"password": "WsTest1234!"
}
WebSocket: ws://localhost:8002/api/v1/emergency/ws/{user_id}?token={jwt_token}
POST /api/v1/alert
Authorization: Bearer {jwt_token}
Content-Type: application/json
{
"latitude": 55.7558,
"longitude": 37.6173,
"address": "Location",
"alert_type": "SOS",
"message": "Emergency message"
}
๐ก Tips
- Keep WebSocket connected while testing SOS alerts
- Messages appear in real-time in the WebSocket Messages Log
- Green indicator = Connection is active
- Red indicator = Connection is lost
- Latency < 100ms is excellent
- Use Monitor tab to track performance