Skip to content

ComponentSocket

[Source]

API for LiveComponent lifecycle methods.

Provides assign management and push events. Unlike Socket, does not provide PubSub subscription or InfoReceiver -- those are connection-level concerns managed by the parent view.

class ref ComponentSocket

Constructors

create

[Source]

new ref create(
  assigns: Assigns ref,
  pending_events: Array[(String val , (JsonObject val | JsonArray val | String val | I64 val | F64 val | Bool val | None val))] ref)
: ComponentSocket ref^

Parameters

Returns


Public Functions

assign

[Source]

Set a component assign value. The framework re-renders after the current handler if any assigns changed.

fun ref assign(
  key: String val,
  value: (String val | TemplateValue box))
: None val

Parameters

Returns


get_assign

[Source]

Read a component assign value.

fun box get_assign(
  key: String val)
: TemplateValue box ?

Parameters

Returns


push_event

[Source]

Push a server-initiated event to the client. Events are queued and flushed after the current render cycle, same as Socket.push_event.

fun ref push_event(
  event: String val,
  payload: (JsonObject val | JsonArray val | String val | 
    I64 val | F64 val | Bool val | 
    None val))
: None val

Parameters

Returns