Skip to main content

Crate stomp_agnostic

Crate stomp_agnostic 

Source
Expand description

§STOMP Agnostic

stomp-agnostic - A transport and async agnostic library for handling of STOMP messages

This library exposes client STOMP functionality through the ClientStompHandle type. The ClientStompHandle needs an implementation of ClientTransport.

This library also exposes server STOMP functionality through the ServerStompHandle type. The ServerStompHandle needs an implementation of ServerTransport.

stomp-agnostic is both transport agnostic and async agnostic.

§(Non-) Performance

This crate does not have a specific focus on performance.

§Transport agnostic

Other STOMP libraries, like async-stomp, wstomp, etc. focus on one, or a few, specific transport methods such as TCP or WebSockets. This crate on the other hand, exposes two traits, ClientTransport and ServerTransport and the implementor is responsible for the transport. This makes this crate compatible with e.g. tokio-tungstenite, but you have to implement the Transport trait yourself, there is nothing implemented for tokio-tungstenite out-of-the box.

§Async agnostic

This crate does not depend on a specific async stack. Bring your own.

§High level STOMP interface and low level control of the transport

ClientStompHandle and ServerStompHandle are the high-level APIs to use when sending and receiving STOMP messages, but stomp-agnostic also makes it easy to get a hold of the underlying transport implementation, both as an exclusive refernce &mut T and consuming the handle itself to get the original T: ClientTransport or T: ServerTransport back, to perform low-level cleanup at any time, usually at the end of a session. This is accomplished through ClientStompHandle::into_transport, ClientStompHandle::as_mut_transport, ServerStompHandle::into_transport, and ServerStompHandle::as_mut_transport.

§Examples

There are two examples: one implementing a basic WebSocket STOMP client using tokio-tungstenite, and another implementing a basic WebSocket STOMP server using axum.

Structs§

ClientStompHandle
A handle that reads and writes STOMP messages given an implementation of ClientTransport.
Message
A representation of a STOMP frame
ServerStompHandle
A handle that reads and writes STOMP messages given an implementation of ServerTransport.

Enums§

AckMode
Acknowledgment modes for STOMP subscriptions
ClientData
A parsed response, either a Message coming from the server, or a custom protocol signal in the Custom variant.
FromServer
A STOMP message sent from the server
ReadData
Data coming down the line from the transport layer. When the transport layer is e.g. WebSocket, custom data such as Ping/Pong can be handled separately from STOMP data by using the Custom variant.
ReadError
ServerResponse
A parsed response, either a Message coming from the server, or a custom protocol signal in the Custom variant.
ToServer
A STOMP message sent by the client
WriteError

Traits§

ClientTransport
ServerTransport