Shtomper 1.0.0
Wrong dependency
See the version list below for details.
dotnet add package Shtomper --version 1.0.0
NuGet\Install-Package Shtomper -Version 1.0.0
<PackageReference Include="Shtomper" Version="1.0.0" />
paket add Shtomper --version 1.0.0
#r "nuget: Shtomper, 1.0.0"
// Install Shtomper as a Cake Addin #addin nuget:?package=Shtomper&version=1.0.0 // Install Shtomper as a Cake Tool #tool nuget:?package=Shtomper&version=1.0.0
This is a basic implementation of STOMP protocol which works over Websocket to transfer lightweight frames.
This repository contains 3 major parts:
- Abstract layer (Shtomper)
- Concrete Websocket Implementation (Shtomper-Client-Websocket)
- JSON Converter implementation (Shtomper-Converter-NewtonsoftJson)
Shtompr is built upon a layer of abstraction so it would be easy to implement clients with different underlying transport mechanisms as well as new converters to support different formats of data serialization.
How to use
StompClientBuilder
- is a part of Shtomper abstraction layer. A base point to start building a client. It's a builder that contains parameters specific to STOMP protocole.
WebSocketStompClientFactoryBuilder
- is a part Shtomper-Client-Websocket client implementation. It's a build that extends IStompClientFactoryBuilder
interface provided by Shtomper abstraction and allows to configure implementation specific details (i. e. Websocket details in this case).
Build(..)
Method return an instance of IStompClientFactory
specific to given concrete builder (i. e. WebSocketStompClientFactory
for WebSocketStompClientFactoryBuilder
) which then can be used to create an instance of IStompClient
which again is specific to builder/factory implementation.
So, in short create shtomper builder ⇒ pass specific builder implementation to it's WithBuilder(..)
method ⇒ build specific factory ⇒ create specific client.
Example usage
var waitHandle = new ManualResetEvent(false);
using var client = new StompClientBuilder()
.SetMessageConverter(new NewtonsoftJsonMessageConverter())
.SetUsername("guest")
.SetPasscode("guest")
.SetHeartbeatCapable(1000)
.SetHeartbeatDesired(1000)
.WithBuilder(new WebSocketStompClientFactoryBuilder())
.SetPort(15674)
.SetHost("localhost")
.SetHostOverride("/") //overrides [host] header for CONNECT frame
.SetPath("ws")
.Build()
.Create();
Action<Dictionary<string, string>> callback = Console.WriteLine;
client.Subscribe("/queue/testQueue", callback);
client.Send(
"/queue/testQueue",
new Dictionary<string, string> {
{ "firstName", "John" },
{ "lastName", "Doe" },
}
);
waitHandle.WaitOne(TimeSpan.FromSeconds(5));
Warning!!!
Project is in very early stage. If for some reason you wish to use it - be warned.
Notes
- All messages are sent asynchronously, from the queue.
- All messages are received asynchronously to the queue where they are being processed by different threads, so your callback will be called on a different thread (obviously)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Websocket.Client (>= 5.1.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Shtomper:
Package | Downloads |
---|---|
Shtomper.Client.Websocket
Websocket client implementation for Shtomper abstraction |
|
Shtomper.Converter.NewtonsoftJson
Json converter implementation for Shtomper. Based on Newtonsoft JSON libs |
GitHub repositories
This package is not used by any popular GitHub repositories.