remote

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 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 Connection

type Connection struct {
	DataChannel *webrtc.DataChannel
	// contains filtered or unexported fields
}

func New

func New() *Connection

func (*Connection) HandleFunc added in v0.1.11

func (w *Connection) HandleFunc(eventName string, handler func(*Message) *Response)

func (*Connection) ListenAndServe added in v0.1.11

func (c *Connection) ListenAndServe()

func (*Connection) ListenForHandshake

func (c *Connection) ListenForHandshake(ctx context.Context) error

func (*Connection) Send added in v0.1.11

func (w *Connection) Send(name string, data any) error

func (*Connection) SendMessage added in v0.1.11

func (w *Connection) SendMessage(msg *Response) error

func (*Connection) Serve added in v0.1.11

func (w *Connection) Serve()

func (*Connection) Stop added in v0.1.11

func (c *Connection) Stop()

type Handler added in v0.1.11

type Handler interface {
	Handle(c *Message) *Response
}

type Message added in v0.1.11

type Message struct {
	ID    string          `json:"id,omitempty"`
	Event string          `json:"event"`
	Data  json.RawMessage `json:"data"`
}

type Response added in v0.1.11

type Response struct {
	ID    string `json:"id,omitempty"`
	Event string `json:"event"`
	Data  any    `json:"data"`
}

Jump to

Keyboard shortcuts

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