Skip to content

Commit 93a7008

Browse files
committed
microtask tick on message
1 parent b4b5638 commit 93a7008

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/json-rpc/upstream/server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export function createUpstreamServer({
7979

8080
logger.info`[${url}] connecting...`;
8181
const ws = new WebSocket(url);
82+
ws.binaryType = "arraybuffer";
8283

8384
ws.onopen = () => {
8485
logger.info`[${url}] connected ok`;
@@ -87,7 +88,9 @@ export function createUpstreamServer({
8788
connection$.next(ws);
8889
};
8990

90-
ws.onmessage = ({ data }) => handleMessage(data.toString());
91+
ws.onmessage = ({ data }) => {
92+
queueMicrotask(() => handleMessage(data.toString()));
93+
};
9194

9295
ws.onclose = (event) => {
9396
connection$.next(null);

0 commit comments

Comments
 (0)