lighthouse

package
v0.0.0-...-f451cff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the API wrapper for communicating with the lighthouse server

func NewClient

func NewClient(url string) (*Client, error)

NewClient creates a new client and connects it to the lighthouse server at the given url

func (*Client) Close

func (c *Client) Close() error

Closes the connection gracefully

func (*Client) Receive

func (c *Client) Receive() (*Response, error)

Receives a response from the websocket connection if available or blocks until a response arrives

func (*Client) Send

func (c *Client) Send(req *Request) error

Sends a request to the websocket connection

type Display

type Display struct {
	User  string
	Token string
	// contains filtered or unexported fields
}

Display is a simple API wrapper for easy animation or game development Note that the methods are not thread-safe!

func NewDisplay

func NewDisplay(user string, token string, url string) (*Display, error)

Create a new display

func NewDisplayWithChannelSize

func NewDisplayWithChannelSize(user string, token string, url string, channelSize int) (*Display, error)

func (*Display) Close

func (d *Display) Close()

Closes the display and the underlying client You cannot open the display again but instead create a new one

func (*Display) GetClient

func (d *Display) GetClient() *Client

Returns a pointer to the underlying client

func (*Display) SendImage

func (d *Display) SendImage(img []byte) error

Sends an image

func (*Display) StartStream

func (d *Display) StartStream() (<-chan []byte, error)

Starts the stream and returns a read-only channel containing the images from the stream

func (*Display) StopStream

func (d *Display) StopStream() error

Stops the stream

type Request

type Request struct {
	REID interface{}
	AUTH map[string]interface{}
	VERB string
	PATH []string
	META map[interface{}]interface{}
	PAYL interface{}
}

Request specifies the format of a request to the lighthouse server

func NewRequest

func NewRequest() *Request

Builder for Request

func (*Request) Auth

func (r *Request) Auth(user, token string) *Request

func (*Request) Meta

func (r *Request) Meta(key interface{}, value interface{}) *Request

func (*Request) Path

func (r *Request) Path(path ...string) *Request

func (*Request) Payl

func (r *Request) Payl(payl interface{}) *Request

func (*Request) Reid

func (r *Request) Reid(reid interface{}) *Request

func (*Request) Verb

func (r *Request) Verb(verb string) *Request

type Response

type Response struct {
	REID     interface{}
	RNUM     int
	RESPONSE string
	META     map[interface{}]interface{}
	PAYL     interface{}
	WARNINGS []interface{}
}

Response specifies the format of a response from the lighthouse server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL