v1.10.1
Message port transfer docs
By default, oRPC serializes request/response messages to string/binary data before sending over message port. If needed, you can define the transfer option to utilize full power of MessagePort: postMessage() method, such as transferring ownership of objects to the other side or support unserializable objects like OffscreenCanvas.
const handler = new RPCHandler(router, {
experimental_transfer: (message, port) => {
const transfer = deepFindTransferableObjects(message) // implement your own logic
return transfer.length ? transfer : null // only enable when needed
}
})
🚀 Features
- client, server: Message port transfer - by @dinwwwh in https://github.com/middleapi/orpc/issues/1113 (66429)
[!TIP] If you find oRPC valuable and would like to support its development, you can do so here.