Real-time communication with MedAssist through WebSocket connection
wss://matrix-ws.eka.care/ws/med-assist/session/<session-id>
<session-id>
{ "ev": "auth", "data": { "token": "{{matrix-token}}" } }
{ "ev": "chat", "ct": "text", "ts": 1757343458000, "_id": "1757343458010", "data": { "text": "I have a headache" } }
{ "ev": "chat", "ct": "audio", "ts": 175510119698, "_id": "175510119699", "data": { "audio": "base64_encoded_audio_data", "audio_format": "audio/mp3" } }
{ "ev": "chat", "ct": "file", "_id": "175510119698" }
{ "ev": "chat", "ct": "file", "_id": "175510119698", "data": { "url": "presigned-url-after-upload" } }
const socket = new WebSocket('wss://matrix-ws.eka.care/ws/med-assist/session/your-session-id'); // Authenticate on connection socket.onopen = function(event) { socket.send(JSON.stringify({ "ev": "auth", "data": { "token": "your-session-token" } })); }; // Send text message function sendTextMessage(text) { const message = { "ev": "chat", "ct": "text", "ts": Date.now(), "_id": Date.now().toString(), "data": { "text": text } }; socket.send(JSON.stringify(message)); } // Handle responses socket.onmessage = function(event) { const response = JSON.parse(event.data); console.log('Received:', response); };
Was this page helpful?