Skip to content
oRPC
Esc
navigateopen⌘Jpreview
On this page

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

[!TIP] If you find oRPC valuable and would like to support its development, you can do so here.

    View changes on GitHub

Last updated on October 24, 2025

Was this page helpful?