glyde/gateway/ready

READY as the protocol reads it: the session, the host to resume on, and who we logged in as.

glyde/model/ready is the host’s view of the same dispatch. This is a separate, tiny decode on purpose, so a bug in that one’s tens of kilobytes cannot cost a session.

Types

pub type ReadyPayload {
  ReadyPayload(
    session_id: String,
    resume_host: option.Option(@internal Host),
    user: id.Id(id.User),
    guild_count: Int,
  )
}

Constructors

  • ReadyPayload(
      session_id: String,
      resume_host: option.Option(@internal Host),
      user: id.Id(id.User),
      guild_count: Int,
    )

    Arguments

    resume_host

    resume_gateway_url reduced to the bare host a RESUME dials. None when there was no host in it, which costs nothing: the configured host answers a RESUME too, and the session is worth more than the hint.

    guild_count

    How many guilds READY listed, not the guilds themselves: glyde/model/ready is the one that decodes them.

Why a READY could not be turned into a session.

pub type ReadyRejected {
  MissingReadyFields
}

Constructors

  • MissingReadyFields

    One of session_id, resume_gateway_url and user.id is missing or the wrong type.

Values

pub fn describe_rejected(why: ReadyRejected) -> String
pub fn read(
  data: dynamic.Dynamic,
) -> Result(ReadyPayload, ReadyRejected)

The parts of READY the protocol needs.

Search Document