When building a Tauri application where the Holochain conductor runs in the same process as the app, use TauriAppTransport instead of a websocket. This class carries the App API over Tauri IPC (Inter-Process Communication) rather than over a network socket.
TauriAppTransport is a drop-in replacement for WsClient. It implements the AppClientTransport interface, meaning it exposes the same request method and acts as an Emittery for signal events. If you are already using AppWebsocket, your code will work unchanged; only the transport layer changes.
Key differences from WebSockets:
- Payloads: It uses the same msgpack-encoded
{ type, value } payloads. - Communication: Payloads are sent through the
plugin:<name>|app_request command via Tauri IPC. - Authentication: No
app_id is sent. The conductor automatically scopes each request to the calling window on the Rust side, replacing the need for a per-app websocket auth token.
// Conceptually, it is used as a drop-in for WsClient in AppWebsocket
// The interface remains the same:
// transport.request(request) -> Promise<response>
// transport.on('signal', callback)