Documentation ¶
Index ¶
- func ConnectWithRetry(url string, delay int) (socket *websocket.Conn, err error)
- func ListenForMessages(socket *websocket.Conn, onMessage func(structs.Message) error, ...)
- func MessageFromJSON(bytes []byte) (structs.Message, error)
- func Retry(delayInMilliseconds int, attemptFn func() bool)
- func WaitFor(condition func() bool, errorMessage string) error
- func WaitForMessageWithName(obj ObjectWithMessages, name string) (structs.Message, error)
- func WaitForf(condition func() bool, errorFn func() error) error
- type ObjectWithMessages
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectWithRetry ¶
ConnectWithRetry will attempt to connect a websocket to the given url retrying if needed with the given delay (milliseconds) between calls
func ListenForMessages ¶
func ListenForMessages(socket *websocket.Conn, onMessage func(structs.Message) error, onError func(error))
ListenForMessages continuously reads from the given websocket calling the given function on each received message
func MessageFromJSON ¶
MessageFromJSON unmarshals bytes into a message
func Retry ¶
Retry will execute the given function until it returns true with the given delay (milliseconds) between calls
func WaitFor ¶
WaitFor waits a maximum of 10 seconds the given condition to become true returning an error with the given message if and only if it does not
func WaitForMessageWithName ¶
func WaitForMessageWithName(obj ObjectWithMessages, name string) (structs.Message, error)
WaitForMessageWithName waits to receive a message with the given name
Types ¶
type ObjectWithMessages ¶
ObjectWithMessages is the interface for a object passed into WaitForMessageWithName