fix(goal): make cancellation a user-only control (#6667)
This commit is contained in:
1 parent
c927808aff
commit
12a86eaa86
33 files changed
+641
-63
No files matched your search
@@ -1,12 +1,12 @@
|
||||
import { NanobotClient } from "@/lib/nanobot-client";
|
||||
import type { InboundEvent } from "@/lib/types";
|
||||
|
||||
export function createStreamClient() {
|
||||
export function createStreamClient(onSend: (frame: string) => void = () => {}) {
|
||||
const socket = {
|
||||
readyState: 1,
|
||||
onopen: null as (() => void) | null,
|
||||
onmessage: null as ((event: MessageEvent) => void) | null,
|
||||
send() {},
|
||||
send: onSend,
|
||||
close() {},
|
||||
};
|
||||
const client = new NanobotClient({
|
||||
@@ -17,6 +17,7 @@ export function createStreamClient() {
|
||||
socket.onopen?.();
|
||||
return {
|
||||
client,
|
||||
socket,
|
||||
receive(event: InboundEvent) {
|
||||
socket.onmessage?.({ data: JSON.stringify(event) } as MessageEvent);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user