Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener struct {
// URL is the url for the websocket. The schema should be "wss" or "ws"
URL *url.URL
// Token is used for authenticating with the websocket. It will be passed
// using the "token" query parameter.
Token string
// SchemaFunc is a function allowing you to customize the output. For example,
// this can be useful for unmarshal a JSON message and formatting the output.
// It should return an io.Reader. If set to nil, the raw message will be outputted.
SchemaFunc SchemaFunc
// Out is an io.Writer to output to.
// doctl hint: this should usually be commands.CmdConfig.Out
Out io.Writer
// InputCh is a channel to send input to the websocket
InCh <-chan []byte
}
Listener implements a ListenerService
type ListenerService ¶
ListenerService listens to a websocket connection and outputs to the provided io.Writer
func NewListener ¶
func NewListener(url *url.URL, token string, schemaFunc SchemaFunc, out io.Writer, inCh <-chan []byte) ListenerService
NewListener returns a configured Listener
Click to show internal directories.
Click to hide internal directories.