We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b18dd5a commit dc546d1Copy full SHA for dc546d1
src/json-rpc/upstream/server.ts
@@ -33,6 +33,7 @@ export function createUpstreamServer({
33
maxConnections = DEFAULT_MAX_CONNECTIONS,
34
retryDelay = DEFAULT_RETRY_DELAY_MS,
35
}: UpstreamServerConfig): UpstreamServer {
36
+ const decoder = new TextDecoder();
37
const connection$ = new BehaviorSubject<WebSocket | null>(null);
38
const unsubscribers = new Map<string, () => void>();
39
const states = new Map<string, unknown>();
@@ -89,7 +90,9 @@ export function createUpstreamServer({
89
90
};
91
92
ws.onmessage = ({ data }) => {
- queueMicrotask(() => handleMessage(data.toString()));
93
+ queueMicrotask(() =>
94
+ handleMessage(typeof data === "string" ? data : decoder.decode(data)),
95
+ );
96
97
98
ws.onclose = (event) => {
0 commit comments