Pamoja.Coap
0.1.17
dotnet add package Pamoja.Coap --version 0.1.17
NuGet\Install-Package Pamoja.Coap -Version 0.1.17
<PackageReference Include="Pamoja.Coap" Version="0.1.17" />
<PackageVersion Include="Pamoja.Coap" Version="0.1.17" />
<PackageReference Include="Pamoja.Coap" />
paket add Pamoja.Coap --version 0.1.17
#r "nuget: Pamoja.Coap, 0.1.17"
#:package Pamoja.Coap@0.1.17
#addin nuget:?package=Pamoja.Coap&version=0.1.17
#tool nuget:?package=Pamoja.Coap&version=0.1.17
Pamoja.Coap
A CoAP client over UDP with confirmable delivery and observe. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
dotnet add package Pamoja.Coap
using Pamoja.Coap;
This pulls in Pamoja.Native, the compiled engine, and Pamoja.Core. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/CoapGuide.cs:
// CoAP runs over UDP and opens no session, so connecting only binds a local
// socket. Nothing is listening on the far side here, and for a non-confirmable
// send nothing needs to be.
using var reporter = new CoapClient(new CoapClientOptions
{
Host = "127.0.0.1",
Port = 5683,
Reliability = Reliability.NonConfirmable,
});
await reporter.ConnectAsync();
Console.WriteLine($"reporter connected: {await reporter.IsConnectedAsync()}");
// Non-confirmable delivery is at most once: the datagram leaves unacknowledged,
// which is what a battery-powered node sends when a missed reading costs nothing.
await reporter.SendAsync("sensors/1/temperature", "21.5"u8.ToArray());
Console.WriteLine("reporter sent 21.5 and did not wait for an answer");
// A command is different: it has to arrive. Confirmable delivery retransmits until
// an acknowledgement comes back. RFC 7252 fixes the defaults at a two-second wait
// and four retransmissions; both are cut short here so the guide does not sit
// waiting.
using var commander = new CoapClient(new CoapClientOptions
{
Host = "127.0.0.1",
Port = 5683,
Reliability = Reliability.Confirmable,
AckTimeoutMs = 20,
MaxRetransmits = 1,
});
await commander.ConnectAsync();
try
{
await commander.SendAsync("actuators/valve", "open"u8.ToArray());
Console.WriteLine("commander the valve acknowledged the command");
}
catch (PamojaException error)
{
Console.WriteLine($"commander gave up unacknowledged: {error.Message}");
}
await reporter.DisconnectAsync();
Console.WriteLine($"reporter disconnected: {!await reporter.IsConnectedAsync()}");
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-coap |
reference, docs.rs, install |
| TypeScript | @pamoja/coap |
reference, install |
| Python | pamoja-coap |
reference, install |
| C# | Pamoja.Coap |
reference, install |
Documentation
Pamoja.Coapreference, every type in this namespace.- The CoAP guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Pamoja.Core (>= 0.1.17)
- Pamoja.Native (>= 0.1.17)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Pamoja.Coap:
| Package | Downloads |
|---|---|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Transports
Transports and testing: Reaching the network when no single link always works, and testing all of it with nothing plugged in. |
GitHub repositories
This package is not used by any popular GitHub repositories.