ws

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(options shared.Options)

Types

type CommandCallback

type CommandCallback func(context.Context, *Message)

type Message

type Message struct {
	Type MessageType     `json:"type"`
	Name string          `json:"name"`
	Body json.RawMessage `json:"body,omitempty"`
	Ref  string          `json:"ref,omitempty"`
	// contains filtered or unexported fields
}

func MessageFromBytes

func MessageFromBytes(bytes []byte) (*Message, error)

func NewMessageWithBody

func NewMessageWithBody(name string, body ...interface{}) (*Message, error)

func (*Message) Bytes

func (m *Message) Bytes() ([]byte, error)

func (*Message) MustText

func (m *Message) MustText() string

func (*Message) Reply

func (m *Message) Reply(name string, body ...interface{}) error

func (*Message) ReplyWithError

func (m *Message) ReplyWithError(err error) error

func (*Message) ReplyWithErrorf

func (m *Message) ReplyWithErrorf(format string, a ...any) error

func (*Message) Text

func (m *Message) Text() (string, error)

type MessageType

type MessageType string
const (
	Update  MessageType = "update"
	Command MessageType = "command"
)

type RobocatFile

type RobocatFile struct {
	Path string `json:"path"`
	// Mime-Type of the file (set only for outputs to aid decoding the payload).
	MimeType string `json:"type"`
	Payload  []byte `json:"payload"`
}

func ParseFileFromMessage

func ParseFileFromMessage(m *Message) (*RobocatFile, error)

type RobocatInput

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

func NewRobocatInput

func NewRobocatInput(runner *RobocatRunner) *RobocatInput

func (*RobocatInput) Handle

func (r *RobocatInput) Handle(
	ctx context.Context,
	message *Message,
)

type RobocatRunner

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

func NewRobocatRunner

func NewRobocatRunner() *RobocatRunner

func (*RobocatRunner) GetFlowBasePath

func (r *RobocatRunner) GetFlowBasePath(elem ...string) (string, error)

func (*RobocatRunner) GetInput

func (r *RobocatRunner) GetInput() *RobocatInput

func (*RobocatRunner) Handle

func (r *RobocatRunner) Handle(
	ctx context.Context,
	message *Message,
)

func (*RobocatRunner) Stop

func (r *RobocatRunner) Stop(
	ctx context.Context,
	message *Message,
)

type RunnerArguments

type RunnerArguments struct {
	Flow  string `json:"flow"`
	Data  string `json:"data"`
	Proxy string `json:"proxy"`
}

func (*RunnerArguments) ToArray

func (a *RunnerArguments) ToArray() []string

type Server

type Server struct {
	Username string
	Password string
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) ConnectionEstablished

func (s *Server) ConnectionEstablished() bool

func (*Server) On

func (s *Server) On(name string, callback CommandCallback)

func (*Server) Send

func (s *Server) Send(name string, body ...interface{}) error

func (*Server) SendError

func (s *Server) SendError(err error) error

func (*Server) SendErrorf

func (s *Server) SendErrorf(format string, a ...any) error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerState added in v0.2.0

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

Jump to

Keyboard shortcuts

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