createMemoryChannel
Defined in: packages/runtime/src/container/proxy.ts:91
Build an in-memory Channel pair for testing.
Returns
Section titled “Returns”A tuple [a, b] where messages posted on a arrive on b.onmessage,
and vice versa.
Remarks
Section titled “Remarks”Uses structuredClone for realistic serialization (catches non-cloneable
payloads the same way a real MessagePort would) and queueMicrotask for
async delivery that mirrors MessagePort timing.
Example
Section titled “Example”import { createMemoryChannel, exportFS, importFS } from '@fishnet/runtime/container/proxy'import { memoryFS } from '@fishnet/core'
const [srvCh, cliCh] = createMemoryChannel()const handle = exportFS(memoryFS(), srvCh)const proxy = importFS(cliCh)// proxy.read / proxy.write now round-trip to the server over cloned messagesproxy.disconnect()handle.dispose()