Commit ·
7e89980
1
Parent(s): d797791
Add conversationWebSocket function for establishing WebSocket connections
Browse files
src/interfaces/conversationWebsocket.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface IConversationWebSocket {
|
| 2 |
+
conversationId: string;
|
| 3 |
+
modality: "voice" | "text";
|
| 4 |
+
}
|
src/services/websockets/conversation.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { IConversationWebSocket } from "../../interfaces/conversationWebsocket";
|
| 2 |
+
|
| 3 |
+
const baseURL = import.meta.env.VITE_WS_URL as string;
|
| 4 |
+
|
| 5 |
+
export function conversationWebSocket(data: IConversationWebSocket): WebSocket {
|
| 6 |
+
return new WebSocket(
|
| 7 |
+
`${baseURL}/conversations?conversation_id=${data.conversationId}&modality=${data.modality}`
|
| 8 |
+
);
|
| 9 |
+
}
|