Coder Social home page Coder Social logo

isobit / arduino-nats Goto Github PK

View Code? Open in Web Editor NEW
81.0 81.0 14.0 26 KB

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

License: MIT License

C++ 100.00%
arduino communication esp8266 microservices nats particle-photon pubsub

arduino-nats's People

Contributors

isobit avatar lasselukkari avatar mjard avatar per1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-nats's Issues

Incoming data prosessing

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.

Nats and wifi

Hi,
in your example, there is :

#include <ESP8266WiFi.h>

Could you find this library in PlatformIO ?
Thanks

PlatformIO

Hi,
i make a new issue 1 to add your library to the PlatformIO environment.

Use username and password for Authentication

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

How to connect to TLS Nats server?

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

Suggestion on publishing arrays

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.

Open source license?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.