Documentation
¶
Index ¶
Constants ¶
View Source
const ( WsCloseRequestTimeout = 60 * time.Second WsCloseResponseTimeout = 3600 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
Types ¶
type RpcRequest ¶
type RpcResponse ¶
type WsRpcClient ¶
type WsRpcClient struct {
Terminated chan bool
// contains filtered or unexported fields
}
func NewWsRpcClient ¶
func NewWsRpcClient(conn *websocket.Conn, debug bool) *WsRpcClient
func (*WsRpcClient) Call ¶
func (client *WsRpcClient) Call(serviceMethod string, args any, reply any) error
func (*WsRpcClient) Close ¶
func (client *WsRpcClient) Close() error
type WsRpcServer ¶
type WsRpcServer struct {
// contains filtered or unexported fields
}
func NewWsRpcServer ¶
func NewWsRpcServer(conn *websocket.Conn, debug bool) *WsRpcServer
func (*WsRpcServer) GetServices ¶
func (server *WsRpcServer) GetServices() []string
func (*WsRpcServer) Listen ¶
func (server *WsRpcServer) Listen() error
func (*WsRpcServer) Register ¶
func (server *WsRpcServer) Register(rcvr any) error
Register publishes in the server the set of methods of the receiver value that satisfy the following conditions:
- exported method of exported type
- two arguments, both of exported type
- the second argument is a pointer
- one return value, of type error
It returns an error if the receiver is not an exported type or has no suitable methods. It also logs the error using package log. The client accesses each method using a string of the form "Type.Method", where Type is the receiver's concrete type.
func (*WsRpcServer) SetWsConnection ¶
func (server *WsRpcServer) SetWsConnection(conn *websocket.Conn)
Click to show internal directories.
Click to hide internal directories.