pub trait RecvFrame {
    fn recv_frame(&mut self) -> Result<Vec<u8>, Error>;
    fn recv_raw(&mut self, len: usize) -> Result<Vec<u8>, Error>;

    fn recv_routed(&mut self) -> Result<RoutedFrame, Error> { ... }
}
Expand description

Frame receiving type which is able to parse raw data (streamed or framed by an underlying overlaid protocol such as ZMQ, HTTP, Websocket).

Required Methods

Receive a single frame of data structured as a byte string. The frame contains LNP framing prefix, which is used by upstream session-level protocols.

Errors

Returns only Error::SocketIo if the overlaid protocol errors with I/O error type

Try to receive len number of bytes and pack them as a frame. The actual amount of bytes received may differ for some protocols, like ZMQ, so the function should be used with caution!

Errors

Returns only Error::SocketIo if the overlaid protocol errors with I/O error type

Provided Methods

Receive frame like with RecvFrame::recv_frame, but only originating from the specified remote address.

Returns

Tuple, consisting of two byte strings:

  • Received frame
  • Source of the frame (i.e. some id of the remote node that sent this frame). The id is specific for the underlying overlaid protocol.
Errors

Returns only Error::SocketIo if the overlaid protocol errors with I/O error type

Panics

Default implementation panics, since most of the framing protocols do not support multipeer sockets and RecvFrame::recv_frame must be used instead (currently only ZMQ-based connections support this operation)

Implementations on Foreign Types

Implementors