Documentation
¶
Index ¶
- func SendRequest[T any](client Client, method, channel string, data any) (value T, err error)
- type BootHandler
- type Client
- type ClientBootHandler
- type ClientConn
- type ClientOptions
- type ClientReadyHandler
- type ClientUpdater
- type Context
- type Data
- type DataWithCode
- type Info
- type KCallback
- type KCollection
- type MCollection
- type NetConn
- type NetIO
- type NetReader
- type NetWriter
- type Options
- type Output
- type ReadyHandler
- type Request
- type RequestHandler
- type RequestHandlerCollection
- type RequestHandlerSubscriber
- type Response
- type ResponseHandler
- type Server
- type ServerConn
- type ServerOptions
- type Update
- type UpdateHandler
- type UpdateSubscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BootHandler ¶ added in v1.0.1
type BootHandler func() (err error)
type Client ¶
type Client interface {
UpdateHandler(subscribers ...UpdateSubscriber)
On(method, channel string, handler UpdateHandler)
SendRequest(method, channel string, data any) (resp Response, err error)
Start(errChan ...chan error)
Stop() error
}
func NewClient ¶
func NewClient(opts ClientOptions) Client
type ClientBootHandler ¶
type ClientConn ¶
type ClientOptions ¶
type ClientReadyHandler ¶
type ClientReadyHandler func(client ClientUpdater) (err error)
type ClientUpdater ¶
type DataWithCode ¶
type KCollection ¶
type MCollection ¶
type NetReader ¶
type NetReader interface {
Read(b []byte) (n int, err error)
ReadByte() (b byte, err error)
ReadBytes(delim byte) (b []byte, err error)
ReadLine(delim byte) (line []byte, isPrefix bool, err error)
ReadRune() (r rune, size int, err error)
ReadSlice(delim byte) (line []byte, err error)
ReadString(delim byte) (s string, err error)
}
type ReadyHandler ¶ added in v1.0.1
type ReadyHandler func() (err error)
type RequestHandler ¶
type RequestHandlerCollection ¶
type RequestHandlerCollection interface {
On(method, channel string, handler RequestHandler) (err error)
}
type RequestHandlerSubscriber ¶
type RequestHandlerSubscriber func(collection RequestHandlerCollection)
type Response ¶
type Response interface {
DataWithCode
GetRequest() Request
}
type ResponseHandler ¶
type ResponseHandler func(data *pResponse)
type Server ¶
type Server interface {
Listen(errChan ...chan error)
OnBoot(handlers ...BootHandler)
OnReady(handlers ...ReadyHandler)
OnClientBoot(handlers ...ClientBootHandler)
OnClientReady(handlers ...ClientReadyHandler)
RequestHandlers(subscribers ...RequestHandlerSubscriber)
Stop() error
}
func NewServer ¶
func NewServer(opts ServerOptions) Server
type ServerConn ¶
type ServerConn interface {
NetConn
}
type ServerOptions ¶
type Update ¶
type Update interface {
DataWithCode
}
type UpdateHandler ¶
type UpdateHandler func(data Update)
type UpdateSubscriber ¶
type UpdateSubscriber func(collection MCollection[UpdateHandler])
Source Files
¶
- client-conn-updater.go
- client-conn.go
- client-options.go
- client-private.go
- client.go
- collection-key.go
- collection-mc.go
- context.go
- data-with-code.go
- data.go
- error.go
- fn-request.go
- fn.go
- getter.go
- info.go
- json.go
- net-conn.go
- net-reader.go
- net-writer.go
- net.go
- options.go
- output.go
- parsers.go
- request-handlers.go
- request.go
- response-handlers.go
- response.go
- server-client-instance.go
- server-conn.go
- server-options.go
- server-private.go
- server.go
- state.go
- update-handlers.go
- update.go
- validator.go
- writer.go
Click to show internal directories.
Click to hide internal directories.