wip
This commit is contained in:
@ -41,6 +41,7 @@ func OnMessage[T any](ctx context.Context, client *Client, mType string) (chan T
|
||||
type Broadcast struct {
|
||||
Name string `mapstructure:"name" json:"name"`
|
||||
Payload any `mapstructure:"payload" json:"payload"`
|
||||
State string `mapstructure:"state" json:"state"`
|
||||
}
|
||||
|
||||
// OnBroadcast listens for ReachView "broadcast" messages
|
||||
@ -52,3 +53,13 @@ func OnBroadcast(ctx context.Context, client *Client) (chan Broadcast, error) {
|
||||
|
||||
return ch, nil
|
||||
}
|
||||
|
||||
// OnMessageType listens for ReachView type of messages
|
||||
func OnMessageType(ctx context.Context, client *Client, messageType string) (chan Broadcast, error) {
|
||||
ch, err := OnMessage[Broadcast](ctx, client, messageType)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
return ch, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user