glitch/eventsub/websocket_message
Types
pub type MessageType {
Notification
SessionWelcome
SessionKeepalive
SessionReconnect
Revocation
}
Constructors
-
Notification
-
SessionWelcome
-
SessionKeepalive
-
SessionReconnect
-
Revocation
pub type Metadata {
Metadata(
message_id: String,
message_type: MessageType,
message_timestamp: String,
)
}
Constructors
-
Metadata( message_id: String, message_type: MessageType, message_timestamp: String, )
pub type NotificationMessagePayload {
NotificationMessagePayload(
subscription: Subscription,
event: Event,
)
}
Constructors
-
NotificationMessagePayload( subscription: Subscription, event: Event, )
pub type Session {
Session(
id: String,
status: SessionStatus,
connected_at: String,
keepalive_timeout_seconds: Int,
reconnect_url: Option(Uri),
)
}
Constructors
-
Session( id: String, status: SessionStatus, connected_at: String, keepalive_timeout_seconds: Int, reconnect_url: Option(Uri), )
pub type SessionStatus {
Connected
}
Constructors
-
Connected
pub type SubscriptionMetadata {
SubscriptionMetadata(
message_id: String,
message_type: MessageType,
message_timestamp: String,
subscription_type: SubscriptionType,
subscription_version: String,
)
}
Constructors
-
SubscriptionMetadata( message_id: String, message_type: MessageType, message_timestamp: String, subscription_type: SubscriptionType, subscription_version: String, )
pub type WebSocketMessage {
Close
NotificationMessage(
metadata: SubscriptionMetadata,
payload: NotificationMessagePayload,
)
SessionKeepaliveMessage(metadata: Metadata)
UnhandledMessage(raw_message: String)
WelcomeMessage(
metadata: Metadata,
payload: WelcomeMessagePayload,
)
}
Constructors
-
Close
-
NotificationMessage( metadata: SubscriptionMetadata, payload: NotificationMessagePayload, )
-
SessionKeepaliveMessage(metadata: Metadata)
-
UnhandledMessage(raw_message: String)
-
WelcomeMessage( metadata: Metadata, payload: WelcomeMessagePayload, )
pub type WelcomeMessagePayload {
WelcomeMessagePayload(session: Session)
}
Constructors
-
WelcomeMessagePayload(session: Session)
Functions
pub fn message_type_from_string(
string: String,
) -> Result(MessageType, Nil)
pub fn message_type_to_string(
message_type: MessageType,
) -> String
pub fn session_status_from_string(
string: String,
) -> Result(SessionStatus, Nil)
pub fn session_status_to_string(
session_status: SessionStatus,
) -> String