Minor Changes
-
aedce03: Add support for server->client RPC calls that mirrors the client->server RPC mechanism just in reverse.
client.expose({ browser: { logs: () => ["blah"], }, });
Protocol Changes
The server->client RPC protocol works identically to the existing client->server RPC call mechanism, just in reverse:
- an inbound
M{id}:method:argsframe is dispatched against the exposed root - methods are looked up using the same dot-notation lookup the server uses for nested method calls, so
browser.logswalksroot.browser.logsand invokes it withthisbound to the immediate receiver. - Returning a value sends
R{id}; throwing or rejecting sendsE{id}with the{code:-1, message}shape the server already uses. - Unknown methods get a structured error back instead of silent drop
- an inbound
Patch Changes
- 32ed3f6: Fix positional-argument shifting when a middle argument is
undefined. Previously[1, undefined, 3]encoded as1,,3— invalid JSON that failed to parse on the receiving side. Now encoded as1,null,3so positions are preserved (theundefinedis coerced tonullper standard JSON semantics).