nimiqclient.websocket_rpc.NimiqSerializer

class nimiqclient.websocket_rpc.NimiqSerializer(websocket)[source]

Bases: JsonSerializingWebSocket

Nimiq Serializer for `RpcMessage`s of fastapi_websocket_rpc.

Parameters:

websocket (SimpleWebSocket) – Web socket as created by the RPC client.

Methods

close

Closes the underlying websocket.

recv

Receives a message.

send

Sends a message.

async close(code=1000)[source]

Closes the underlying websocket.

Parameters:

code (int) – Code to use for closing the websocket.

async recv()[source]

Receives a message.

Returns:

Deserialized message in RpcMessage format.

Return type:

RpcMessage

async send(msg)[source]

Sends a message.

Parameters:

msg (RpcMessage) – Message to serialize.