mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Merge pull request #301 from Monadical-SAS/sara/fix-websockets
fixes websockets
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { Topic, FinalSummary, Status } from "./webSocketTypes";
|
||||
import { useError } from "../../(errors)/errorContext";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { DomainContext } from "../domainContext";
|
||||
|
||||
type UseWebSockets = {
|
||||
transcriptText: string;
|
||||
@@ -25,6 +26,8 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
|
||||
const { setError } = useError();
|
||||
const router = useRouter();
|
||||
|
||||
const { websocket_url } = useContext(DomainContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (isProcessing || textQueue.length === 0) {
|
||||
return;
|
||||
@@ -290,7 +293,7 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
|
||||
|
||||
if (!transcriptId) return;
|
||||
|
||||
const url = `${process.env.NEXT_PUBLIC_WEBSOCKET_URL}/v1/transcripts/${transcriptId}/events`;
|
||||
const url = `${websocket_url}/v1/transcripts/${transcriptId}/events`;
|
||||
const ws = new WebSocket(url);
|
||||
|
||||
ws.onopen = () => {
|
||||
|
||||
Reference in New Issue
Block a user