Versions in this module Expand all Collapse all v1 v1.0.0 Feb 3, 2023 Changes in this version + const TwitchApiHost + const TwitchApiMaxTopics + const TwitchApiPath + const TwitchApiPingEach + const TwitchApiPingTimeout + const TwitchApiScheme + type Answer struct + Data any + Error string + Nonce string + Type AnswerType + func (a *Answer) GetData() AnswerDataMessage + func (a *Answer) Parse() + func (a Answer) HasError() bool + func (a Answer) JSON() []byte + type AnswerDataMessage struct + Message string + Topic string + func (a AnswerDataMessage) JSON() []byte + type AnswerDataTopics struct + Topics []string + func (a AnswerDataTopics) JSON() []byte + type AnswerType string + const Listen + const Message + const Ping + const Pong + const Reconnect + const Response + const Unlisten + func (a AnswerType) String() string + type Connection struct + Connection *websocket.Conn + ID int64 + func NewConnection(url url.URL) *Connection + func (c *Connection) AddTopic(topic string) + func (c *Connection) Close() error + func (c *Connection) HasTopic(topic string) bool + func (c *Connection) OnConnect(fn func(*Connection)) + func (c *Connection) OnDisconnect(fn func(*Connection)) + func (c *Connection) OnError(fn func(*Connection, error)) + func (c *Connection) OnInfo(fn func(*Connection, string)) + func (c *Connection) OnMessage(fn func(*Connection, *Answer)) + func (c *Connection) OnPing(fn func(*Connection, time.Time)) + func (c *Connection) OnPong(fn func(*Connection, time.Time, time.Time)) + func (c *Connection) RemoveAllTopics() + func (c *Connection) RemoveTopic(topic string) + func (c *Connection) Topics() []string + func (c *Connection) TopicsCount() int + type PubSub struct + Connections map[int64]*Connection + URL url.URL + func New() *PubSub + func NewWithURL(url url.URL) *PubSub + func (c *PubSub) OnConnect(fn func(*Connection)) + func (c *PubSub) OnDisconnect(fn func(*Connection)) + func (c *PubSub) OnError(fn func(*Connection, error)) + func (c *PubSub) OnInfo(fn func(*Connection, string)) + func (c *PubSub) OnMessage(fn func(*Connection, *Answer)) + func (c *PubSub) OnPing(fn func(*Connection, time.Time)) + func (c *PubSub) OnPong(fn func(*Connection, time.Time, time.Time)) + func (p *PubSub) Close() + func (p *PubSub) HasTopic(topic string, params ...interface{}) bool + func (p *PubSub) Listen(ctx context.Context, topic string, params ...interface{}) + func (p *PubSub) Topic(topic string, params ...interface{}) string + func (p *PubSub) Topics() []string + func (p *PubSub) TopicsCount() int + func (p *PubSub) Unlisten(ctx context.Context, topic string, params ...interface{})