XmtpElixirSdk.BrowserShim (xmtp_elixir_sdk v0.1.2)

Copy Markdown

Browser-shim contracts for browser-only SDK work.

Most of the SDK is designed to run in Elixir. This namespace exists only for the pieces that must be handled by a browser runtime, such as worker messaging or browser-managed storage.

It keeps the contract small and explicit:

  • typed action envelopes for worker-style messaging
  • a minimal async stream primitive
  • request builders for the OPFS adapter surface

If you are building a server-only integration, you can usually ignore this namespace.

Summary

Functions

Build a failed browser-shim response envelope.

Generate a unique request or stream id for browser-shim traffic.

Build a browser-shim request envelope.

Build a successful browser-shim response envelope.

Build a streamed error envelope from the browser shim.

Build a streamed event envelope from the browser shim.

Types

action_name()

@type action_name() :: String.t()

stream_id()

@type stream_id() :: String.t()

Functions

error(action, request_id, reason)

Build a failed browser-shim response envelope.

id()

@spec id() :: String.t()

Generate a unique request or stream id for browser-shim traffic.

request(action, data \\ %{})

Build a browser-shim request envelope.

response(action, request_id, result)

Build a successful browser-shim response envelope.

stream_error(action, stream_id, reason)

Build a streamed error envelope from the browser shim.

stream_event(action, stream_id, result)

Build a streamed event envelope from the browser shim.