Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { DestinationID string // contains filtered or unexported fields }
Channel is an abstraction over a chromecast channel.
func (*Channel) OnMessage ¶
func (c *Channel) OnMessage(responseType string, cb func(*api.CastMessage))
OnMessage adds a callback listener for a certain type of message with specified responseType
func (*Channel) Request ¶
func (c *Channel) Request(payload HasRequestID, timeout time.Duration) (*api.CastMessage, error)
Request sends a payload and returns the message the chromecast gives back. Throws an error if timeout has passed waiting for the message to be returned.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a basic connector to the chromecast event stream.
func NewClient ¶
NewClient is a constructor for a Client object. Host and Port are for the chromecast's network info.
func (*Client) Close ¶
func (c *Client) Close()
Close closes the real socket connection that the client has to the chromecast.
func (*Client) NewChannel ¶
NewChannel constructs a communication channel towards a chromecast device with a specified namespace. namespace are those namespaces that are specified by the chromecast API.
type HasRequestID ¶
type HasRequestID interface {
// contains filtered or unexported methods
}
HasRequestID is a generic type describing any form of request to a channel. All requests need to have a request id.
type PayloadHeaders ¶
type PayloadHeaders struct { Type string `json:"type"` RequestID *int `json:"requestId,omitempty"` }
PayloadHeaders are general request components for any message to be passed to a chromecast.