Documentation
¶
Index ¶
- Constants
- func EventPack(input any) ([]byte, error)
- func EventUnpack(input []byte, output any) error
- type Client
- type Connection
- func (conn *Connection) Accept(writer http.ResponseWriter, request *http.Request) error
- func (conn *Connection) Close()
- func (conn *Connection) Connect(address string) error
- func (conn *Connection) EnableEncryption(encryption Encryption)
- func (conn *Connection) Receive() (EventType, []byte, error)
- func (conn *Connection) Send(eventType EventType, message []byte) error
- func (conn *Connection) SetSharedKey(key []byte)
- type ConnectionError
- type Encryption
- type Event
- type EventData
- type EventError
- type EventHandler
- type EventType
- type HttpRouteHandler
- type HttpServer
- type HttpServerError
- type Protocol
Constants ¶
View Source
const (
MagicalMessage websocket.MessageType = iota + 3
)
Variables ¶
This section is empty.
Functions ¶
func EventUnpack ¶
Types ¶
type Client ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(subprotocol string) *Connection
func (*Connection) Accept ¶
func (conn *Connection) Accept(writer http.ResponseWriter, request *http.Request) error
func (*Connection) Close ¶
func (conn *Connection) Close()
func (*Connection) Connect ¶
func (conn *Connection) Connect(address string) error
func (*Connection) EnableEncryption ¶
func (conn *Connection) EnableEncryption(encryption Encryption)
func (*Connection) SetSharedKey ¶
func (conn *Connection) SetSharedKey(key []byte)
type ConnectionError ¶
func (ConnectionError) Error ¶
func (err ConnectionError) Error() string
type Encryption ¶
type EventError ¶
type EventHandler ¶
type EventHandler func(*Connection, []byte) Event
type HttpRouteHandler ¶
type HttpRouteHandler func(http.ResponseWriter, *http.Request)
type HttpServer ¶
type HttpServer struct { Address string // contains filtered or unexported fields }
func NewHttpServer ¶
func NewHttpServer() *HttpServer
func (*HttpServer) Bind ¶
func (server *HttpServer) Bind(pattern string, handler HttpRouteHandler)
func (*HttpServer) Close ¶
func (server *HttpServer) Close()
func (*HttpServer) Listen ¶
func (server *HttpServer) Listen() error
func (*HttpServer) ServeHTTP ¶
func (server *HttpServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type HttpServerError ¶
func (HttpServerError) Error ¶
func (err HttpServerError) Error() string
type Protocol ¶
func NewProtocol ¶
func (*Protocol) BindEventHandler ¶
func (proto *Protocol) BindEventHandler(eventType EventType, eventHandler EventHandler)
func (*Protocol) WebSocketHandler ¶
func (proto *Protocol) WebSocketHandler(writer http.ResponseWriter, request *http.Request)
Click to show internal directories.
Click to hide internal directories.