gateway

package
v0.0.0-...-688b8c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebSocketHandler

func WebSocketHandler(w http.ResponseWriter, r *http.Request)

WebSocketHandler is used to handle websocket connections.

Types

type AcceptedPayload

type AcceptedPayload struct {
	// HeartbeatInterval is the interval to send HeartbeatPayload at in milliseconds.
	HeartbeatInterval uint `msgpack:"heartbeat_interval"`
}

AcceptedPayload is used to define a payload sent after the connection is accepted but before the connection is "done". Spherical might be internally dialling other nodes at this point.

type Channel

type Channel struct {
	// ID is the ID of the channel.
	ID uint64 `msgpack:"id"`

	// Name is the name of the channel.
	Name string `msgpack:"name"`

	// Type is the type of the channel.
	Type ChannelType `msgpack:"type"`

	// Permissions is the permissions of the channel.
	Permissions ChannelPermissions `msgpack:"permissions"`
}

Channel is used to define a channel inside a guild.

type ChannelPermissions

type ChannelPermissions uint64

ChannelPermissions is used to define the permissions for a channel.

type ChannelType

type ChannelType string

ChannelType is the type of channel.

const (
	// ChannelTypeText is a text channel.
	ChannelTypeText ChannelType = "text"

	// ChannelTypeVoice is a voice channel.
	ChannelTypeVoice ChannelType = "voice"
)

type DisconnectPayload

type DisconnectPayload struct {
	// Reason is the reason for the disconnect.
	Reason string `json:"reason"`

	// Reconnect is used to define if the client should reconnect.
	Reconnect bool `json:"reconnect"`
}

DisconnectPayload is used to define a disconnect payload. This is a special case because it is json.

type Guild

type Guild struct {
	// ID is the ID of the guild.
	ID uint64 `msgpack:"id"`

	// Hostname is the hostname where the guild is. Note that this should be blank if this is a cross node socket.
	Hostname string `msgpack:"hostname,omitempty"`

	// Available is whether the guild is available. THe remainder of the struct is not filled if this is false.
	Available bool `msgpack:"available"`

	// Name is the name of the guild.
	Name string `msgpack:"name,omitempty"`

	// Icon is the icon of the guild.
	Icon string `msgpack:"icon,omitempty"`

	// Splash is the splash of the guild.
	Splash string `msgpack:"splash,omitempty"`

	// Channels is the channels of the guild.
	Channels []Channel `msgpack:"channels,omitempty"`

	// OwnerID is the ID of the owner of the guild.
	OwnerID uint64 `msgpack:"owner_id,omitempty"`

	// Members is the members of the guild.
	Members []*Member `msgpack:"members,omitempty"`
}

Guild is used to define any information about guilds.

type GuildUpdatePayload

type GuildUpdatePayload struct {
	Guild `msgpack:",inline"`
}

GuildUpdatePayload is used to define a guild update payload.

type HeartbeatPayload

type HeartbeatPayload struct {
	// ID is the ID of the heartbeat.
	ID string `msgpack:"id"`
}

HeartbeatPayload is used to define a heartbeat payload. The client or server that gets this should immediately respond with a heartbeat of the same ID.

type HelloPayload

type HelloPayload struct {
	// Token is the token to use.
	Token string `msgpack:"token"`

	// CrossNode is used to define if the token is cross node. You can generally omit this if you are a client. This is
	// for nodes.
	CrossNode bool `msgpack:"cross_node,omitempty"`
}

HelloPayload is used to define a hello payload.

type JoinGuildPayload

type JoinGuildPayload struct {
	// Hostname is the hostname where the guild is. Note that this should be blank if this is a cross node socket.
	Hostname string `msgpack:"hostname,omitempty"`

	// InviteCode is the invite code to use.
	InviteCode string `msgpack:"invite_code"`

	// ReplyID is the ID to reply with.
	ReplyID string `msgpack:"reply_id"`
}

JoinGuildPayload is used to define a join guild payload.

type Member

type Member struct {
	// ID is the ID of the member.
	ID uint64 `msgpack:"id"`

	// Hostname is the hostname of the member.
	Hostname string `msgpack:"hostname"`
}

Member is used to define the partial member object.

type ReadyPayload

type ReadyPayload struct {
	// AvailableGuilds is the guilds that are available.
	AvailableGuilds []Guild `msgpack:"available_guilds"`

	// UnavailableGuilds is the guilds that are unavailable.
	UnavailableGuilds []Guild `msgpack:"unavailable_guilds"`
}

ReadyPayload is used to define a ready payload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL