Go to file
Shawn 02fe8560e2
Improve emqx_hooks and credentials (#2309)
* Improve emqx_hooks and credentials

1. Modify the return modes of emqx hooks.

Change the return value of hook functions to:
- ok: stop the hook chain and return ok
- {error, Reason}: stop the hook chain and return error
- continue: continue the hook chain

And the return value of emqx_hooks:run/2 is changed to:
- ok
- {error, Reason}

And the return value of emqx_hooks:run/3:
- {ok, Acc}
- {error, Reason, Acc}

2. Treat password as a member of credentials.

Password should be wrapped in the `credentials` data-structure, as the
username/password pair together consists of an authentication method.
There can be some methods using some other credential data (e.g.
a JWT token), and these credential data should also be wrapped in the
the `credentials` data-structure.

An event `client.authenticate` is triggered when an user logs in:
```erlang
emqx_hooks:run('client.authenticate', [], Credentials)
```

A `default callback` that deny/allow any user (according to the
`allow_anonymous` config) should be appended to the end of the
callback chain.

The `credentails` is passed through all of the callbacks, and
can be changed over in this process.

* Refactor emqx hooks return mode

* Remove password from PState
2019-03-16 10:43:53 +08:00
.github TEMPLATE 2016-11-10 17:26:02 +08:00
etc Support TLS/DTLS PSK (#2297) 2019-03-13 22:24:19 +08:00
include Move request response out of emqx client (#2293) 2019-03-13 11:27:25 +08:00
priv Support TLS/DTLS PSK (#2297) 2019-03-13 22:24:19 +08:00
src Improve emqx_hooks and credentials (#2309) 2019-03-16 10:43:53 +08:00
test Improve emqx_hooks and credentials (#2309) 2019-03-16 10:43:53 +08:00
.editorconfig add editorconfig for emqx 2018-09-03 14:03:20 +08:00
.gitignore Add emqx_portal interfaces 2019-02-28 11:17:27 +08:00
.travis.yml Update erlang/otp version for ci (#2141) 2019-01-10 00:11:57 +08:00
LICENSE Licensed under the Apache, Version 2.0 2016-02-05 14:26:17 +08:00
Makefile Improve emqx_hooks and credentials (#2309) 2019-03-16 10:43:53 +08:00
README.md Use the new site 'emqx.io' 2019-02-11 15:41:29 +08:00
rebar.config Update gen_rpc to v2.3.1 (#2315) 2019-03-15 10:30:14 +08:00
rebar.config.script Auto-pull-request-by-2019-02-19 (#2232) 2019-02-19 14:00:34 +08:00
vars Generate a config file for testing 2018-09-07 07:04:04 +02:00

EMQ X Broker

EMQ X broker is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.

Starting from 3.0 release, EMQ X broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the EMQ X broker can scaled to 10+ million concurrent MQTT connections on one cluster.

Installation

The EMQ X broker is cross-platform, which can be deployed on Linux, Unix, Mac, Windows and even Raspberry Pi.

Download the binary package for your platform from here.

Build From Source

The EMQ X broker requires Erlang/OTP R21+ to build since 3.0 release.

git clone https://github.com/emqx/emqx-rel.git

cd emqx-rel && make

cd _rel/emqx && ./bin/emqx console

Quick Start

# Start emqx
./bin/emqx start

# Check Status
./bin/emqx_ctl status

# Stop emqx
./bin/emqx stop

To view the dashboard after running, use your browser to open: http://localhost:18083

Roadmap

The EMQ X Roadmap uses Github milestones to track the progress of the project.

Community, discussion, contribution, and support

You can reach the EMQ community and developers via the following channels:

Please submit any bugs, issues, and feature requests to emqx/emqx.

MQTT Specifications

You can read the mqtt protocol via the following links:

MQTT Version 3.1.1

MQTT Version 5.0

MQTT SN

License

Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.