All Projects → isobit → Arduino Nats

isobit / Arduino Nats

Licence: mit
An Arduino / ESP8266 / Particle Photon compatible C++ library for communicating with a NATS (http://nats.io) server

Projects that are alternatives of or similar to Arduino Nats

Pjon
PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
Stars: ✭ 2,615 (+5843.18%)
Mutual labels:  arduino, communication, esp8266
Irremoteesp8266
Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
Stars: ✭ 1,964 (+4363.64%)
Mutual labels:  arduino, communication, esp8266
Esp32 esp8266 wifi speaker oled
A MP3 streaming WiFi speaker for ESP8266 & ESP32 chips
Stars: ✭ 20 (-54.55%)
Mutual labels:  arduino, esp8266
Easyntpclient
Library to read time from Network Time Protocol (NTP) servers.
Stars: ✭ 20 (-54.55%)
Mutual labels:  arduino, esp8266
Smarthome
💡 智能电器管理综合系统
Stars: ✭ 33 (-25%)
Mutual labels:  arduino, esp8266
Esp8266 Wifi Relay
simple sketch of using ESP8266WebServer to switch relays on GPIO pins. It serves a simple website with toggle buttons for each relay
Stars: ✭ 13 (-70.45%)
Mutual labels:  arduino, esp8266
Esp8266 pir
ESP8266 Motion Detector to IFTTT
Stars: ✭ 15 (-65.91%)
Mutual labels:  arduino, esp8266
Esp8266 Bitcoin Ssid Ticker
A Bitcoin SSID ticker for ESP8266's written in Arduino C/C++
Stars: ✭ 31 (-29.55%)
Mutual labels:  arduino, esp8266
Iot cloudcloud
Stars: ✭ 26 (-40.91%)
Mutual labels:  arduino, esp8266
Jdonframework
Domain-Driven-Design Pub/Sub Domain-Events framework
Stars: ✭ 978 (+2122.73%)
Mutual labels:  microservices, pubsub
Esp8266audio
Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
Stars: ✭ 972 (+2109.09%)
Mutual labels:  arduino, esp8266
Esp3d
FW for ESP8266/ESP8285/ESP32 used with 3D printer
Stars: ✭ 979 (+2125%)
Mutual labels:  arduino, esp8266
Esp8266 thing dev
An all-in-one development board for the ESP8266 including an FTDI FT231X for USB programming.
Stars: ✭ 11 (-75%)
Mutual labels:  arduino, esp8266
Nats.rb
Ruby client for NATS, the cloud native messaging system.
Stars: ✭ 850 (+1831.82%)
Mutual labels:  pubsub, nats
Openwifidetectoresp8266
MASLOW: an Open WiFi Detector with ESP8266
Stars: ✭ 15 (-65.91%)
Mutual labels:  arduino, esp8266
Wi Pwn
ESP8266 Deauther ​with a material design WebUI 📶
Stars: ✭ 839 (+1806.82%)
Mutual labels:  arduino, esp8266
Catchme
CatchME - WiFi Fun Box "Having Fun with ESP8266"
Stars: ✭ 28 (-36.36%)
Mutual labels:  arduino, esp8266
Ultimate Backend
Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
Stars: ✭ 978 (+2122.73%)
Mutual labels:  microservices, nats
Esp8266 Anemometer
ESP8266 based wind anemometer project
Stars: ✭ 22 (-50%)
Mutual labels:  arduino, esp8266
Mqtt via esp01
TCP/UDP Applicaton for UNO/MEGA/STM32 using ESP8266's AT firmware.
Stars: ✭ 23 (-47.73%)
Mutual labels:  arduino, esp8266

NATS - Arduino Client

An Arduino / Spark Core / Particle Photon compatible C++ library for communicating with a NATS server.

Features

  • Header-only library
  • Compatible with Ethernet and WiFi-cabable Arduinos, Particle Photon / Spark Core devices, and even the ESP8266 (if using the Arduino extension)
  • Familiar C++ object-oriented API, similar usage to the official NATS client APIs
  • Automatically attempts to reconnect to NATS server if the connection is dropped

Installation

PlatformIO

platformio lib install ArduinoNATS

Arduino IDE

Download a zip from the latest release and add it via Sketch > Include Library > Add .ZIP Library.

Manual

Just download ArduinoNATS.h and include it in your main ino file.

API

class NATS {
	typedef struct {
		const char* subject;
		const int sid;
		const char* reply;
		const char* data;
		const int size;
	} msg;

	typedef void (*sub_cb)(msg e);
	typedef void (*event_cb)();

	NATS(
		Client* client,
		const char* hostname,
		int port = NATS_DEFAULT_PORT,
		const char* user = NULL,
		const char* pass = NULL
	);

	bool connect();			// initiate the connection
	void disconnect();      // close the connection

	bool connected;			// whether or not the client is connected

	int max_outstanding_pings;	// number of outstanding pings to allow before considering the connection closed (default 3)
	int max_reconnect_attempts; // number of times to attempt reconnects, -1 means no maximum (default -1)

	event_cb on_connect;    // called after NATS finishes connecting to server
	event_cb on_disconnect; // called when a disconnect happens
	event_cb on_error;		// called when an error is received

	void publish(const char* subject, const char* msg = NULL, const char* replyto = NULL);
	void publish(const char* subject, const bool msg);
	void publishf(const char* subject, const char* fmt, ...);

	int subscribe(const char* subject, sub_cb cb, const char* queue = NULL, const int max_wanted = 0);
	void unsubscribe(const int sid);

	int request(const char* subject, const char* msg, sub_cb cb, const int max_wanted = 1);

	void process();			// process pending messages from the buffer, must be called regularly in loop()
}
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].