Documentation ¶
Index ¶
- Constants
- func ServerMaker() (*server.Server, jrpctest.ClientMaker, func())
- func WebsocketHandler(s *server.Server, allowedOrigins []string) http.Handler
- func WsClientHeaders(endpoint, origin string) (string, http.Header, error)
- type Client
- type Codec
- func (c *Codec) Close() error
- func (c *Codec) Closed() <-chan struct{}
- func (c *Codec) Flush() error
- func (c *Codec) PeerInfo() jsonrpc.PeerInfo
- func (c *Codec) ReadBatch(ctx context.Context) ([]*jsonrpc.Message, bool, error)
- func (c *Codec) RemoteAddr() string
- func (c *Codec) Write(p []byte) (n int, err error)
- type Server
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ServerMaker ¶
func ServerMaker() (*server.Server, jrpctest.ClientMaker, func())
func WebsocketHandler ¶
WebsocketHandler returns a handler that serves JSON-RPC to WebSocket connections.
allowedOrigins should be a comma-separated list of allowed origin URLs. To allow connections with any origin, pass "*".
Types ¶
type Client ¶
func DialWebsocket ¶
DialWebsocket creates a new RPC client that communicates with a JSON-RPC server that is listening on the given endpoint.
The context is used for the initial connection establishment. It does not affect subsequent interactions with the client.
func DialWebsocketWithDialer ¶
func DialWebsocketWithDialer(ctx context.Context, endpoint, origin string, opts *websocket.DialOptions) (*Client, error)
that is listening on the given endpoint using the provided dialer.
Click to show internal directories.
Click to hide internal directories.