isobit / arduino-nats Goto Github PK
View Code? Open in Web Editor NEWAn Arduino / ESP8266 / Particle Photon compatible C++ library for communicating with a NATS (http://nats.io) server
License: MIT License
An Arduino / ESP8266 / Particle Photon compatible C++ library for communicating with a NATS (http://nats.io) server
License: MIT License
The Arduino PubSubClient does a good job of this: https://github.com/knolleary/pubsubclient/tree/master/tests
Currently it's impossible to process the incoming data as a stream because at the time when the control is given to the callback function the data is already read to the buffer. Because of the limited memory on the embedded devices messages are limited at max to a few kilobytes.
It's also common to use predefined fixed size buffer that can be optionally given as parameter if the predefined size doesn't suit your needs. The memory limitations are easier to deal with if the memory consumption is predictable.
How about changing the message data to a function that reads the data to the buffer on demand when it's called and additionally exposing a read function that reads from the client until the the end of message is met? This way the data can processed as char array or as a stream.
Hi,
in your example, there is :
#include <ESP8266WiFi.h>
Could you find this library in PlatformIO ?
Thanks
Hi,
i make a new issue 1 to add your library to the PlatformIO environment.
can you write nats client to support esp-idf framework
Hi
I use the following example to connect to NATS server with ESP8266, but by adding a username and password, I can not connect to the server.
https://github.com/isobit/arduino-nats/blob/master/examples/blink/blink.ino
WiFiClient client;
NATS nats(
&client,
"iot-backend.isaan.ir", NATS_DEFAULT_PORT,
"emicro",
"xxxxxxxx"
);
I've added my username and password as above.
[2185] 2019/01/30 02:42:08.366138 [TRC] 192.168.12.64:60204 - cid:254 - <<- [-ERR authorization timeout]
[2185] 2019/01/30 02:42:08.366242 [DBG] 192.168.12.64:60204 - cid:254 - Authorization Timeout
[2185] 2019/01/30 02:42:08.366253 [DBG] 192.168.12.64:60204 - cid:254 - Client connection closed
I am unable to connect to a NATS server with TLS enabled. I tried using the WifiSecureClient but no luck. Can anyone help me connection with a TLS enabled NATS server and also possibly with client side certificate also
Hi,
I am trying to publish an array of doubles by converting it to const char array using memcpy
.
The problem is that if I set the array size bigger and bigger, the subscriber will get wrong data: about first 100 values are sent correctly, but from the next becomes garbage data.
After struggling, I came to a conclusion that there is a problem setting a message buffer when I'm trying to publish data too large.
So I suggest, could you add ability to publish message with the message length something like this:
void publish(const char* subject, const char* msg, int msg_length);
I appreciate your work.
One of my team is looking into adding NATS streaming support, and would like to share his changes (if you're interested). Our open source release process makes it difficult to contribute to projects without a license. Would you be willing to add one?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.