GPUI.Remote.Client (gpui v0.2.0-rc.1)

Copy Markdown View Source

Display-side client for a remote GPUI application session.

The client owns a local display, synchronizes remote snapshots into it, and forwards local display events to GPUI.Remote.Server.

Options

  • :host and :port - required remote endpoint;
  • :ssl - false or SafeRPC TLS options;
  • :display - local display module, defaulting to GPUI.Display.Native;
  • :display_opts - options passed to the display;
  • :session_id - stable session identity, generated when omitted;
  • :poll_interval - positive milliseconds or nil to disable display polling, defaulting to 16;
  • :name - optional client process name.

Summary

Functions

Waits until a complete display frame follows the current window state.

Waits for a display frame completed after the supplied generation.

Builds the remote client's OTP child specification.

Dispatches one normalized event remotely and synchronizes its snapshot.

Returns the latest completed display frame generation for a window.

Mounts or remounts the configured application session and synchronizes its snapshot.

Fetches and synchronizes the current remote session snapshot.

Starts a remote display client linked to the caller.

Subscribes the calling process to synchronized remote display updates.

Unsubscribes the calling process from remote display updates.

Functions

await_frame(server, window_id, timeout \\ 5000)

@spec await_frame(GenServer.server(), pos_integer(), pos_integer()) ::
  :ok | {:error, term()}

Waits until a complete display frame follows the current window state.

await_frame_after(server, window_id, generation, timeout \\ 5000)

@spec await_frame_after(
  GenServer.server(),
  pos_integer(),
  non_neg_integer(),
  pos_integer()
) ::
  :ok | {:error, term()}

Waits for a display frame completed after the supplied generation.

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Builds the remote client's OTP child specification.

event(client, event)

@spec event(GenServer.server(), map()) :: {:ok, GPUI.Snapshot.t()} | {:error, term()}

Dispatches one normalized event remotely and synchronizes its snapshot.

frame_token(server, window_id)

@spec frame_token(GenServer.server(), pos_integer()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Returns the latest completed display frame generation for a window.

mount(client, args \\ %{})

@spec mount(GenServer.server(), map() | keyword()) ::
  {:ok, GPUI.Snapshot.t()} | {:error, term()}

Mounts or remounts the configured application session and synchronizes its snapshot.

snapshot(client)

@spec snapshot(GenServer.server()) :: {:ok, GPUI.Snapshot.t()} | {:error, term()}

Fetches and synchronizes the current remote session snapshot.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a remote display client linked to the caller.

subscribe(client)

@spec subscribe(GenServer.server()) :: :ok

Subscribes the calling process to synchronized remote display updates.

unsubscribe(client)

@spec unsubscribe(GenServer.server()) :: :ok

Unsubscribes the calling process from remote display updates.