Documentation ¶
Index ¶
- Variables
- func IgnoreCommand(_ *Client, _ *Message) error
- func RandomNone() string
- type Client
- func (client *Client) AddShoutoutChannel(broadcasterID string) error
- func (client *Client) Backoff()
- func (client *Client) Close()
- func (client *Client) Connect() error
- func (client *Client) Forever()
- func (client *Client) Listen(topics ...string) error
- func (client *Client) Loop() error
- func (client *Client) Ping() error
- func (client *Client) Receive() (*Message, error)
- func (client *Client) ReceiveWithContext(ctx context.Context) (*Message, error)
- func (client *Client) RemoveShoutoutChannel(broadcasterID string) error
- func (client *Client) Send(message *Message) error
- func (client *Client) SendRegistration() error
- func (client *Client) Unlisten(topics ...string) error
- type CommandCallback
- type Message
- type MessageData
- type ShoutoutPayload
- type TopicsData
Constants ¶
This section is empty.
Variables ¶
View Source
var StandardCommandCallbacks = map[string]CommandCallback{ "PONG": IgnoreCommand, "RESPONSE": IgnoreCommand, "RECONNECT": func(client *Client, message *Message) error { _ = client.Connection.Close(websocket.StatusNormalClosure, "") client.Connection = nil return nil }, }
Functions ¶
func IgnoreCommand ¶
func RandomNone ¶
func RandomNone() string
Types ¶
type Client ¶
type Client struct { Connection *websocket.Conn Topics map[string]int TopicsMutex sync.Mutex CommandCallbacks map[string]CommandCallback ReconnectAttempts int }
func (*Client) AddShoutoutChannel ¶
func (*Client) ReceiveWithContext ¶
func (*Client) RemoveShoutoutChannel ¶
func (*Client) SendRegistration ¶
type CommandCallback ¶
type Message ¶
type Message struct { Type string `json:"type"` Error string `json:"error,omitempty"` Nonce string `json:"nonce,omitempty"` Data MessageData `json:"data,omitempty"` }
type MessageData ¶
type ShoutoutPayload ¶
type ShoutoutPayload struct { Type string `json:"type,omitempty"` Data struct { BroadcasterUserID string `json:"broadcasterUserID,omitempty"` TargetUserID string `json:"targetUserID,omitempty"` TargetLogin string `json:"targetLogin,omitempty"` TargetUserProfileImageURL string `json:"targetUserProfileImageURL,omitempty"` SourceUserID string `json:"sourceUserID,omitempty"` SourceLogin string `json:"sourceLogin,omitempty"` ShoutoutID string `json:"shoutoutID,omitempty"` TargetUserDisplayName string `json:"targetUserDisplayName,omitempty"` TargetUserCTAInfo string `json:"targetUserCTAInfo,omitempty"` TargetUserPrimaryColorHex string `json:"targetUserPrimaryColorHex,omitempty"` } `json:"data"` }
type TopicsData ¶
type TopicsData struct {
Topics []string `json:"topics,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.