server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CanFrame

type CanFrame struct {
	ArbitrationID uint32 `json:"arbitrationID"`
	DLC           uint8  `json:"DLC"`
	Data          []byte `json:"data"` // base64
}

func NewCanFrame

func NewCanFrame(arbitrationID uint32, DLC uint8, data []byte) *CanFrame

func (*CanFrame) GetData

func (f *CanFrame) GetData() (raw []byte, err error)

type ReceiveCallback

type ReceiveCallback func(msg any)

type WsMsg

type WsMsg struct {
	Device string               `json:"device"`
	Msg    cancoder.CanValueDef `json:"message"`
}

type WsServer

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

func NewWsServer

func NewWsServer(port uint16, path string, receiveCallback ReceiveCallback, apiKey string, certificate []byte, privateKey []byte) *WsServer

func (*WsServer) OnConnect

func (t *WsServer) OnConnect(id int)

func (*WsServer) OnDisconnect

func (t *WsServer) OnDisconnect(id int)

func (*WsServer) OnFailure

func (t *WsServer) OnFailure(exited bool, err error)

func (*WsServer) OnReceive

func (t *WsServer) OnReceive(msg websocket.Message)

func (*WsServer) Send

func (s *WsServer) Send(msg any) error

func (*WsServer) SendCanFrame

func (s *WsServer) SendCanFrame(frame CanFrame) error

func (*WsServer) SendEncoded

func (s *WsServer) SendEncoded(msg WsMsg) error

func (*WsServer) Serve

func (s *WsServer) Serve() error

Jump to

Keyboard shortcuts

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