modulepackage
0.0.8
Repository: https://github.com/team-tau/tau-client-go.git
Documentation: pkg.go.dev
# README
Go TAU Client
This library is designed to make integrating with TAU in go, taking care of parsing out the messages and calling the registered receivers. From there all you have to do is create the logic around the various events that you can receive.
Callbacks
You can implement any/all of these callbacks in your own code to take advantage of this library allowing you to take care of the business logic, while this library takes care of parsing messages into usable structs.
RawCallback(msg []byte)
- All websocket messages received will be forwarded to this callback untouched. Note this will not stop processing via more specific callbacks.ErrorCallback(err error)
- Used to handle websocket type errors like when the websocket is closed by the remote source, if this is not handled then errors here will cause apanic
.StreamOnlineCallback(msg *StreamOnlineMsg)
- Called when a streamer goes onlineStreamOfflineCallback(msg *StreamOnlineMsg)
- Called when a streamer goes offlineFollowCallback(msg *FollowMsg)
- Called when a new follow event is received.StreamUpdateCallback(msg *StreamUpdateMsg)
- Called when a stream update event is received.CheerCallback(msg *CheerMsg)
- Called when a cheer event is received.RaidCallback(msg *RaidMsg)
- Called when a raid event is received.SubscriptionCallback(msg *SubscriptionMsg)
- Called when a subscription event is received.PointsRedemptionCallback(msg *PointsRedemptionMsg)
- Called when a points redemption event is received. Breaking change coming in a future version based on an upcoming TAU changeHypeTrainBeginCallback(msg *HypeTrainBeginMsg)
- Called when a hype train beginning event is received.HypeTrainProgressCallback(msg *HypeTrainProgressMsg)
- Called when a hype train progress event is received.HypeTrainEndCallback(msg *HypeTrainEndedMsg)
- Called when a hype train end event is received.
Utility Functions
GetAuthToken
- Allows for getting your auth token via username and password. Ideally you would keep your auth token in your config, but this just gives you another option of how to get the data.SetParallelProcessing
- Allows you to process messages in parallel, defaults tofalse
.Reconnect
- Can be used to reconnect to the websocket on a connection error via theErrorCallback
.
# Functions
GetAuthToken is used to get the auth token for a user to interact with TAU given a username and password.Ideally this would be gathered from the UI and potentially stored in a config of some sort, but this option existsin case that is not an option.
NewClient allows you to get a new client that is connected to TAU.
# Structs
AuthorizationError represents an Unauthorized response from Twitch.
BadRequestError represents bad inputs from an application trying to make an API request totwitch based on their documented limitations.
CheerMsg is a message that represents a cheer event that TAU sends.
Client represents a client connected to TAU.
Event is the common parts of every event coming from TAU.
FollowMsg is a message representing a follow event that TAU sends.
GenericError represents a non-specific error, sorta a catch all.
HypeTrainBeginMsg is a message that represents a hype train begin event that TAU sends.
HypeTrainEndedMsg is a message that represents a hype train end event that TAU sends.
HypeTrainProgressMsg is a message that represents a hype train progress event that TAU sends.
PointsRedemptionMsg is a message that represents a points redemption event that TAU sends.
RaidMsg is a message that represents a raid event that TAU sends.
StreamOfflineMsg is a message that represents a stream offline event that TAU sends.
StreamOnlineMsg is a message that represents a stream online event that TAU sends.
StreamUpdateMsg is a message that represents a stream update event that TAU sends.
SubscriptionMsg is a message that represents a subscription event that TAU sends.
TAUStream represents a stream as TAU returns them from it's database.
TAUStreamer represents a streamer as TAU returns them from it's database.
Time wraps the standard time.Time to allow for custom parsing from json.
# Type aliases
CheerCallback is a callback to handle cheer events.
ErrorCallback is a callback to handle websocket specific errors where the websocket likely needs to be re-establishedand a new client is needed.
FollowCallback is a callback to handle follow events.
HypeTrainBeginCallback is a callback to handle hype train begin events.
HypeTrainEndCallback is a callback to handle hype train end events.
HypeTrainProgressCallback is a callback to handle hype train progress events.
PointsRedemptionCallback is a callback to handle points redemption events.
RaidCallback is a callback to handle raid events.
RawCallback is a callback that will be called for every message that is received.
StreamOfflineCallback is a callback to handle the stream going offline event.
StreamOnlineCallback is a callback to handle the stream coming online event.
StreamUpdateCallback is a callback to handle updates to the stream information (like title).
SubscriptionCallback is a callback to handle subscription events.
TAUTags is a list of strings containing tags from a stream.