All Projects → Covertness → Coap Rs

Covertness / Coap Rs

Licence: mit
A Constrained Application Protocol(CoAP) library implemented in Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Coap Rs

Emqx
An Open-Source, Cloud-Native, Distributed MQTT Message Broker for IoT.
Stars: ✭ 8,951 (+6892.97%)
Mutual labels:  coap
Crates Io Cli
Interact with crates.io from the command-line
Stars: ✭ 82 (-35.94%)
Mutual labels:  crates
Ikea Tradfri Coap Docs
How can you communicate to your ikea tradfri gateway/hub through coap-client
Stars: ✭ 111 (-13.28%)
Mutual labels:  coap
Node Lwm2m
OMA LwM2M protocol implementation for Node
Stars: ✭ 41 (-67.97%)
Mutual labels:  coap
Half Rs
Half-precision floating point types f16 and bf16 for Rust.
Stars: ✭ 68 (-46.87%)
Mutual labels:  crates
Awalwm2m
Awa LWM2M is an implementation of the OMA Lightweight M2M protocol in C.
Stars: ✭ 93 (-27.34%)
Mutual labels:  coap
Rust Multibase
Multibase in rust
Stars: ✭ 30 (-76.56%)
Mutual labels:  crates
Bnf
Parse BNF grammar definitions
Stars: ✭ 124 (-3.12%)
Mutual labels:  crates
Accord
Data validation library for Rust
Stars: ✭ 72 (-43.75%)
Mutual labels:  crates
Bvh
A fast BVH using SAH in rust
Stars: ✭ 108 (-15.62%)
Mutual labels:  crates
Flogo Contrib
Flogo Contribution repo. Contains activities, triggers, models and actions.
Stars: ✭ 60 (-53.12%)
Mutual labels:  coap
Thingsboard
Open-source IoT Platform - Device management, data collection, processing and visualization.
Stars: ✭ 10,526 (+8123.44%)
Mutual labels:  coap
Mainflux
Industrial IoT Messaging and Device Management Platform
Stars: ✭ 1,341 (+947.66%)
Mutual labels:  coap
Rust Skiplist
Skiplist implementation in rust
Stars: ✭ 38 (-70.31%)
Mutual labels:  crates
Iot Technical Guide
🐝 IoT Technical Guide --- 从零搭建高性能物联网平台及物联网解决方案和Thingsboard源码分析 ✨ ✨ ✨ (IoT Platform, SaaS, MQTT, CoAP, HTTP, Modbus, OPC, WebSocket, 物模型,Protobuf, PostgreSQL, MongoDB, Spring Security, OAuth2, RuleEngine, Kafka, Docker)
Stars: ✭ 2,334 (+1723.44%)
Mutual labels:  coap
Syntect
Rust library for syntax highlighting using Sublime Text syntax definitions.
Stars: ✭ 972 (+659.38%)
Mutual labels:  crates
Inflector
A rust inflection library
Stars: ✭ 88 (-31.25%)
Mutual labels:  crates
Anterofit
Strongly typed, asynchronous REST client framework for Rust.
Stars: ✭ 125 (-2.34%)
Mutual labels:  crates
Anjay
C implementation of the client-side OMA LwM2M protocol
Stars: ✭ 115 (-10.16%)
Mutual labels:  coap
Qcloud Iot Sdk Embedded C
SDK for connecting to Tencent Cloud IoT from a device using embedded C.
Stars: ✭ 109 (-14.84%)
Mutual labels:  coap

coap-rs

Travis Build Status Windows Build Status Downloads Coverage Status MIT licensed

A fast and stable Constrained Application Protocol(CoAP) library implemented in Rust.

Features:

Documentation

Installation

First add this to your Cargo.toml:

[dependencies]
coap = "0.9"

Example

Server:

#![feature(async_closure)]

use coap_lite::{RequestType as Method};
use coap::Server;
use tokio::runtime::Runtime;

fn main() {
    let addr = "127.0.0.1:5683";

	Runtime::new().unwrap().block_on(async move {
		let mut server = Server::new(addr).unwrap();
		println!("Server up on {}", addr);
		
		server.run(async move |request| {
            match request.get_method() {
				&Method::Get => println!("request by get {}", request.get_path()),
				&Method::Post => println!("request by post {}", String::from_utf8(request.message.payload).unwrap()),
				&Method::Put => println!("request by put {}", String::from_utf8(request.message.payload).unwrap()),
				_ => println!("request by other method"),
			};
			
			return match request.response {
				Some(mut message) => {
					message.message.payload = b"OK".to_vec();
					Some(message)
				},
				_ => None
			};
    	}).await.unwrap();
	});
}

Client:

use coap::CoAPClient;

fn main() {
    let url = "coap://127.0.0.1:5683/Rust";
    println!("Client request: {}", url);

    let response = CoAPClient::get(url).unwrap();
    println!("Server reply: {}", String::from_utf8(response.message.payload).unwrap());
}

Benchmark

$ cargo bench
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].