Skip to content

Commit 10ef9eb

Browse files
committed
fix(reactive-rpc): 🐛 always use binary encoding for Websocket messages
1 parent e018a72 commit 10ef9eb

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/__tests__/reactive-rpc/uws/ws/rx-rpc/RpcPersistentClient.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if (process.env.TEST_E2E) {
3030

3131
['rpc.rx.binary.cbor', binary, cbor, cbor],
3232
['rpc.rx.binary.msgpack', binary, msgpack, msgpack],
33-
// ['rpc.rx.binary.json', binary, json, json],
33+
['rpc.rx.binary.json', binary, json, json],
3434
// ['rpc.rx.binary.json-cbor', binary, json, cbor],
3535
// ['rpc.rx.binary.json-msgpack', binary, json, msgpack],
3636
// ['rpc.rx.binary.cbor-json', binary, cbor, json],

src/reactive-rpc/server/uws/RpcApp.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ export class RpcApp<Ctx extends ConnectionContext> {
158158
const resCodec = ctx.resCodec;
159159
const msgCodec = ctx.msgCodec;
160160
const encoder = resCodec.encoder;
161-
const isBinary = resCodec.format !== EncodingFormat.Json || msgCodec.format === RpcMessageFormat.Binary;
162161
ws.rpc = new RpcMessageStreamProcessor({
163162
caller: this.options.caller,
164163
send: (messages: ReactiveRpcMessage[]) => {
@@ -167,7 +166,7 @@ export class RpcApp<Ctx extends ConnectionContext> {
167166
writer.reset();
168167
msgCodec.encodeBatch(resCodec, messages);
169168
const encoded = writer.flush();
170-
ws.send(encoded, isBinary, false);
169+
ws.send(encoded, true, false);
171170
},
172171
bufferSize: 1,
173172
bufferTime: 0,

0 commit comments

Comments
 (0)