shimmer/ws/event_loop

Types

pub type ActorState {
  ActorState(
    heartbeat_interval: Int,
    sequence: Int,
    conn: Connection,
    meta: WebsocketMeta,
    selector: Selector(Message),
    subject: Subject(Message),
    shard: Shard(Message),
    session: Option(GatewaySession),
  )
}

Constructors

  • ActorState(
      heartbeat_interval: Int,
      sequence: Int,
      conn: Connection,
      meta: WebsocketMeta,
      selector: Selector(Message),
      subject: Subject(Message),
      shard: Shard(Message),
      session: Option(GatewaySession),
    )
pub type GatewaySession {
  GatewaySession(session_id: String, resume_gateway_url: String)
}

Constructors

  • GatewaySession(session_id: String, resume_gateway_url: String)
pub type Message {
  WebsocketFrame(websocket.Frame)
  UpdatePresence(Presence)
  Beat
  Halt
}

Constructors

  • WebsocketFrame(websocket.Frame)

    Frames from Gun

  • UpdatePresence(Presence)

    Send a request to update the Bot’s presence

  • Beat

    Heartbeat Message Only

  • Halt

    Kill the Actor

pub type WebsocketMeta {
  WebsocketMeta(
    token: String,
    intents: List(Intent),
    handlers: Handlers(Message),
  )
}

Constructors

  • WebsocketMeta(
      token: String,
      intents: List(Intent),
      handlers: Handlers(Message),
    )

Functions

pub fn actor_loop(msg: Message, state: ActorState) -> Next(
  ActorState,
)
pub fn actor_setup(client: Client(Message), gateway_url: String, handlers: Handlers(
    Message,
  )) -> fn() -> InitResult(ActorState, Message)
Search Document