Documentation ¶
Index ¶
- func MakeRequest[T any](client *Client, method, channel string, data any) (value T, err error)
- type AuthCallback
- type BootCallback
- type ChannelData
- type Client
- func (x *Client) Auth(callbacks ...AuthCallback)
- func (x *Client) Boot(callbacks ...BootCallback)
- func (x *Client) Connect(opts *Options) (errChan chan error)
- func (x *Client) On(method, channel string, handler UpdateHandler)
- func (x *Client) Request(method, channel string, data any) (value Data, err error)
- func (x *Client) Run() (err error)
- func (x *Client) SetRequestTimeout(timeout int)
- func (x *Client) Start(opts *Options) chan error
- func (x *Client) Stop() (err error)
- func (x *Client) Updates(callbacks ...UpdateRouterCallback)
- type ClientInitCallback
- type ClientUpdateRouter
- type Connection
- type Context
- type Data
- type Error
- type Inbound
- type InboundConnection
- type InboundPredicate
- type Info
- type Options
- type Output
- type OutputData
- type Request
- type RequestHander
- type RequestRouter
- type RequestRouterCallback
- type Response
- type Server
- func (x *Server) Auth(callbacks ...AuthCallback)
- func (x *Server) Boot(callbacks ...BootCallback)
- func (x *Server) Connect(opts *Options) (errChan chan error)
- func (x *Server) Listen(opts *Options) (err error)
- func (x *Server) OnClientInit(callbacks ...ClientInitCallback)
- func (x *Server) Routes(callbacks ...RequestRouterCallback)
- func (x *Server) Run() (err error)
- func (x *Server) Stop() (err error)
- type ServerRequestRouter
- type Update
- type UpdateHandler
- type UpdateRouter
- type UpdateRouterCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthCallback ¶
type AuthCallback func(conn Connection) (err error)
type BootCallback ¶
type BootCallback func() (err error)
type ChannelData ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Auth ¶
func (x *Client) Auth(callbacks ...AuthCallback)
func (*Client) Boot ¶
func (x *Client) Boot(callbacks ...BootCallback)
func (*Client) On ¶
func (x *Client) On(method, channel string, handler UpdateHandler)
func (*Client) SetRequestTimeout ¶
Set Timeout for requests (in seconds). Defaults to 30 seconds
func (*Client) Updates ¶
func (x *Client) Updates(callbacks ...UpdateRouterCallback)
type ClientInitCallback ¶
type ClientInitCallback func(i InboundConnection) (err error)
type ClientUpdateRouter ¶
type ClientUpdateRouter struct {
// contains filtered or unexported fields
}
func (*ClientUpdateRouter) Clear ¶
func (x *ClientUpdateRouter) Clear(method, channel string)
func (*ClientUpdateRouter) On ¶
func (x *ClientUpdateRouter) On(method, channel string, handler UpdateHandler)
func (*ClientUpdateRouter) Send ¶
func (x *ClientUpdateRouter) Send(method, channel string, data Data)
type Connection ¶
type Connection interface { ReadBytes(delim byte) (b []byte, err error) ReadLine() (b []byte, err error) ReadString(delim byte) (s string, err error) ReadStringLine() (s string, err error) Write(p []byte) (n int, err error) WriteLine(p []byte) (n int, err error) WriteString(s string) (n int, err error) WriteStringLine(s string) (n int, err error) }
type Error ¶
type Error struct { ChannelData UUID string `json:"uuid"` Code int `json:"code"` Message string `json:"message"` }
func (Error) GetContent ¶
type Inbound ¶
type Inbound struct { Info // contains filtered or unexported fields }
type InboundConnection ¶
type InboundPredicate ¶
type Info ¶
func (*Info) GenerateUUID ¶
func (x *Info) GenerateUUID()
type OutputData ¶
type Request ¶
type Request struct { ChannelData UUID string `json:"uuid"` Content []byte `json:"content"` }
func (*Request) SetContent ¶
type RequestHander ¶
type RequestRouter ¶
type RequestRouter interface {
Set(method, channel string, handler RequestHander)
}
type RequestRouterCallback ¶
type RequestRouterCallback func(router RequestRouter)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Auth ¶
func (x *Server) Auth(callbacks ...AuthCallback)
func (*Server) Boot ¶
func (x *Server) Boot(callbacks ...BootCallback)
func (*Server) OnClientInit ¶
func (x *Server) OnClientInit(callbacks ...ClientInitCallback)
func (*Server) Routes ¶
func (x *Server) Routes(callbacks ...RequestRouterCallback)
type ServerRequestRouter ¶
type ServerRequestRouter struct {
// contains filtered or unexported fields
}
func (*ServerRequestRouter) Delete ¶
func (x *ServerRequestRouter) Delete(method, channel string)
func (*ServerRequestRouter) Get ¶
func (x *ServerRequestRouter) Get(method, channel string) (handler RequestHander, ok bool)
func (*ServerRequestRouter) Set ¶
func (x *ServerRequestRouter) Set(method, channel string, handler RequestHander)
type Update ¶
type Update struct { ChannelData // UUID string `json:"uuid"` Code int `json:"code"` Content []byte `json:"content"` }
func (*Update) SetContent ¶
type UpdateHandler ¶
type UpdateHandler func(data OutputData)
type UpdateRouter ¶
type UpdateRouter interface {
On(method, channel string, handler UpdateHandler)
}
type UpdateRouterCallback ¶
type UpdateRouterCallback func(router UpdateRouter)
Click to show internal directories.
Click to hide internal directories.