Skip to content

rpc.rpcwebsocket #

Handlers

The module comes with

fn echo_handler #

fn echo_handler(client &websocket.Client, msg string) !string

fn new_client #

fn new_client(address string, logger &log.Logger) !&RpcWsClient

fn new_rpcwsclient #

fn new_rpcwsclient(address string, logger &log.Logger) !&RpcWsClient

fn new_rpcwsserver #

fn new_rpcwsserver(port int, handler MessageHandler, logger &log.Logger) !&RpcWsServer

struct RpcWsClient #

@[heap]
struct RpcWsClient {
pub mut:
	client                    &Client
	channel_incoming_messages chan string
	logger                    &log.Logger
}

fn (RpcWsClient) run #

fn (mut w RpcWsClient) run() !

fn (RpcWsClient) send #

fn (mut w RpcWsClient) send(message string, timeout int) !string

fn (RpcWsClient) send_json_rpc #

fn (mut w RpcWsClient) send_json_rpc[T, D](method string, data T, timeout int) !D

struct RpcWsServer #

@[heap]
struct RpcWsServer {
pub mut:
	server  &Server
	logger  &log.Logger
	handler MessageHandler @[required]
}

fn (RpcWsServer) run #

fn (mut rws RpcWsServer) run() !