# Socket.IO — Conversation Events (ReValue)

Message persistence runs in Laravel (`POST /api/{client|provider}/conversations/{id}/messages`).  
Node joins rooms and broadcasts after Laravel accepts the message.

## Client → Server

| Event | Payload |
|---|---|
| `enter-conversation` | `{ conversation_id }` |
| `exit-conversation` | `{ conversation_id }` |
| `send-conversation-message` | `{ conversation_id, body, token? }` |

Pass Sanctum `token` in handshake query or on each send.

`userType`: `client` (buyer) or `provider` (seller).

## Server → Client

| Event | Meaning |
|---|---|
| `conversation-joined` | You joined the room |
| `conversation-presence` | Peer joined/left (`event`: `joined`\|`left`) |
| `conversation-message` | New message for everyone in the room |
| `conversation-message-sent` | Ack to sender |
| `conversation-message-failed` | Laravel rejected the message |

Room name: `conversation:{id}`.
