-
Notifications
You must be signed in to change notification settings - Fork 45
refactor(loop) separate client and loop #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Tieske
wants to merge
65
commits into
xHasKx:master
Choose a base branch
from
Tieske:keepalive
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 57 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
d0ea08f
chore(*) add config files (busted/editor)
Tieske a4d5b8b
feat(topics) add validation and matching
Tieske 8fff431
refactor(keepalive) remove keepalive logic from ioloop
Tieske 6c9c48a
refactor(receive) separate out logic for handling a packet
Tieske d81f66c
fix(error) do not silently discard error
Tieske a5f5d27
refactor(locals) reduce variable scopes
Tieske c2956d6
feat(ping-timeout) implement ping timeout
Tieske af85356
feat(*) rewrite loop logic
Tieske 136f3ce
feat(ioloop) add incremental back-off for idle clients
Tieske 40bcd43
fix(mqtt5) pass errors on as is (like mqtt4)
Tieske 8f8773a
wip
Tieske eda35db
fix(client) first_connect was not properly updated
Tieske 567ee31
fix(tests) fix more tests, ioloop related
Tieske 18cc55b
fix(copas) fix copas connector and test
Tieske 13b43d4
chore(ci) add ansicolors+lualogging for testing
Tieske 57ff134
fix(keep-alive) should always return an interval as first result
Tieske f6f6131
chore(examples) fix copas examples, remove sync example
Tieske 6115148
fix(docs) update ssl defaults to match code
Tieske 7ff684a
feat(options) allow full uri to be specified
Tieske 30c3efc
chore(connectors) move files in subdir
Tieske ab736fe
chore(luasocket) integrate luasocket and luasocket-ssl
Tieske e34562f
feat(connector) add auto-detection for connectors
Tieske a600bd7
chore(test) added secure test for copas
Tieske fe062f6
fix(ssl) restore 'ssl_module' option and add proper checks
Tieske 2db6e72
chore(validation) move secure conn validation+defaults to conn
Tieske c87bbbf
fix(reconnect) fix reconnect logic
Tieske 587b121
feat(client) pass event handlers on init
Tieske ca6f39b
feat(shutdown) adds a client:shutdown method and event
Tieske c02e3d2
fix(rockspec) add 'connector.init' module to rockspec
Tieske 0e15eaa
chore(examples) update to use 'opts.on' and auto-connector select
Tieske 1fc5859
fix(openresty) fix/rewrite the openresty examples
Tieske dc1c261
feat(*) add nginx/copas specific code for adding clients
Tieske 2d10112
fix(example) typos
Tieske b5d03b8
chore(docs) update docs
Tieske ca71e1b
chore(docs) reduce tab-size in docs for readability
Tieske 1c04d08
fix(reconnect) set a number default (30 secs) if true
Tieske c8583cf
chore(test) rename test file
Tieske aa8f5c0
fix(timeouts) copas and nginx should have indefinite timeouts on reading
Tieske 1300b0d
fix(loop) make packet handling async for copas/nginx
Tieske 043badc
fix(send) add a lock when sedning for Copas connector
Tieske 5bc4a92
fix(deps) bump to Copas 4
Tieske e9d8b39
fix(docs) minor documentation updates
Tieske 196f7af
fix(copas) prevent accidental disabling of keep-alive
Tieske 8bafeb6
fix(copas) switch to pause instead of sleep
Tieske 7b8cb78
chore(docs) fix some typos
Tieske bbd5226
fix(patterns) escape lua magic characters
Tieske e452151
chore(docs) small doc updates/fixes
Tieske b44634a
feat(clean): option to only connect clean on first connect
Tieske be50bd1
change(topic): parsing topics distinguish no-match from error
Tieske b19fb52
chore(ci): fix linter warnings
Tieske b16be62
markdownlint: improved config
xHasKx 23a070b
lua version fix md file
xHasKx 82c6213
README.md: added short installation header
xHasKx aa207ac
README.md: busted tests dependency fix
xHasKx a84c7e4
markdown link fix
xHasKx c652064
markdown fix
xHasKx 46fb48a
markdown improve
xHasKx fe730ba
markdown improved a bit
xHasKx 8312df3
markdown improved a bit + openresty.lua path fix
xHasKx 1669a15
markdown fix
xHasKx f8411de
markdown fix
xHasKx de92f3c
fix(buffered): properly calculate the remainder to be read
Tieske d712269
fix(luasocket): return the partial results read
Tieske 1e2a118
docs(mqtt): fix some doc comments
Tieske d977890
chore(log): namespace all logs with '[LuaMQTT]'
Tieske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| return { | ||
| default = { | ||
| ROOT = { "tests/spec" }, | ||
| lpath = "./?.lua;./?/?.lua;./?/init.lua", | ||
| helper = "./tests/configure-log.lua", | ||
| verbose = true, | ||
| coverage = false, | ||
| output = "gtest", | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| local/ | ||
| luacov.stats.out | ||
| luacov.report.out | ||
| examples/openresty/logs/*.log | ||
| *.swp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| default: true | ||
| single-title: false | ||
| line-length: false | ||
| code-block-style: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Installation | ||
|
|
||
| As luamqtt is almost zero-dependency you have to install any optional Lua libraries by | ||
| yourself, before using the luamqtt library. | ||
|
|
||
| When installing using [LuaRocks](http://luarocks.org/modules/xhaskx/luamqtt), the | ||
| LuaSocket dependency will automatically be installed as well, as it is a listed dependency | ||
| in the rockspec. | ||
|
|
||
| luarocks install luamqtt | ||
|
|
||
| To install from source clone the repo and make sure the `./mqtt/` folder is in your | ||
| Lua search path. | ||
|
|
||
| Check the [dependencies](./02-dependencies.md) on how (and when) to install those. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Dependencies | ||
|
|
||
| The dependencies differ slightly based on the environment you use, and the requirements you have: | ||
|
|
||
| * [**luasocket**](https://luarocks.org/modules/luasocket/luasocket) to establish TCP connections to the MQTT broker. | ||
| This is a listed dependency in the luamqtt rockspec, so it will automatically be installed if you use LuaRocks to | ||
| install luamqtt. To install it manually: | ||
|
|
||
| luarocks install luasocket | ||
|
|
||
| * [**copas**](https://github.com/keplerproject/copas) module for asynchoneous IO. Copas is an advanced co-routine | ||
| scheduler with far more features than the included `ioloop`. For anything more than a few devices, or for devices which | ||
| require network IO beyond mqtt alone, Copas is the better alternative. Copas is also pure-Lua, but has parallel network | ||
| IO (as opposed to sequential network IO in `ioloop`), and has features like; threads, timers, locks, semaphores, and | ||
| non-blocking clients for http(s), (s)ftp, and smtp. | ||
|
|
||
| luarocks install copas | ||
|
|
||
| * [**luasec**](https://github.com/brunoos/luasec) module for SSL/TLS based connections. This is optional and may be | ||
| skipped if you don't need secure network connections (e.g. broker is located in your local network). It's not listed | ||
| in package dependencies, please install it manually like this: | ||
|
|
||
| luarocks install luasec | ||
|
|
||
| * [**LuaBitOp**](http://bitop.luajit.org/) library to perform bitwise operations, which is required only on | ||
| Lua 5.1. It's not listed in package dependencies, please install it manually like this: | ||
|
|
||
| luarocks install luabitop | ||
|
|
||
| * [**LuaLogging**](https://github.com/lunarmodules/lualogging/) to enable logging by the MQTT client. This is optional | ||
| but highly recommended for long running clients. This is a great debugging aid when developing your clients. Also when | ||
| using OpenResty as your runtime, you'll definitely want to use this, see | ||
| [openresty.lua](https://xhaskx.github.io/luamqtt/examples/openresty.lua.html) for an example. | ||
| It's not listed in package dependencies, please install it manually like this: | ||
|
|
||
| luarocks install lualogging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Lua versions | ||
|
|
||
| It's tested to work on Debian 9 GNU/Linux with Lua versions: | ||
|
|
||
| * Lua 5.1 ... Lua 5.4 (**i.e. any modern Lua version**) | ||
| * LuaJIT 2.0.0 ... LuaJIT 2.1.0 beta3 | ||
| * It may also work on other Lua versions without any guarantees | ||
|
|
||
| So basically it should work on any modern Linux-based OS with Lua interpreter available. | ||
|
|
||
| Also has run under **Windows** and it was ok, but installing luarocks-modules may be a non-trivial task on this OS. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.