Module mqtt.connector.copas
Copas based connector.
Copas is an advanced coroutine scheduler in pure-Lua. It uses LuaSocket
under the hood, but in a non-blocking way. It also uses LuaSec for TLS
based connections (like the mqtt.connector.luasocket one). And hence uses
the same defaults for the secure
option when creating the client.
Caveats:
* the client option ssl_module
is not supported by the Copas connector,
It will always use the module named ssl
.
* multiple threads can send simultaneously (sending is wrapped in a lock)
* since the client creates a long lived connection for reading, it returns upon receiving a packet, to call an event handler. The handler must return swiftly, since while the handler runs the socket will not be reading. Any task that might take longer than a few milliseconds should be off loaded to another thread (the Copas-loop will take care of this).
NOTE: you will need to install copas like this: luarocks install copas
.