This commit is contained in:
Feng 2016-02-25 22:37:52 +08:00
parent 18be4ee3b2
commit e368afea36
2 changed files with 44 additions and 43 deletions

View File

@ -5,21 +5,24 @@
Get Started Get Started
=========== ===========
-------------------- --------
Overview Overview
-------------------- --------
-------------------- emqttd is a massively scalable and clusterable MQTT V3.1/V3.1.1 broker written in Erlang/OTP.
Goals
--------------------
-------------------- emqttd is aimed to provide a solid, enterprise grade, extensible open-source MQTT broker for IoT, M2M and Mobile applications that need to support ten millions of concurrent MQTT clients.
MQTT Protocol
--------------------
-------------------------- * Easy to install
* Massively scalable
* Easy to extend
* Solid stable
-----------
Quick Start Quick Start
-------------------------- -----------
Download binary packeges for Linux, Mac, FreeBSD and Windows from http://emqtt.io/downloads.
.. code:: console .. code:: console
@ -34,9 +37,9 @@ Quick Start
# Stop emqttd # Stop emqttd
./bin/emqttd stop ./bin/emqttd stop
-------------------- -----------------
Compile from Source Build from Source
-------------------- -----------------
.. code:: console .. code:: console
@ -166,9 +169,9 @@ Test Client
sysctl -w net.ipv4.ip_local_port_range="500 65535" sysctl -w net.ipv4.ip_local_port_range="500 65535"
echo 1000000 > /proc/sys/fs/nr_open echo 1000000 > /proc/sys/fs/nr_open
---------------------------- ----------------------
emqtt Client Libraries emqtt Client Libraries
---------------------------- ----------------------
GitHub: https://github.com/emqtt GitHub: https://github.com/emqtt

View File

@ -1,9 +1,9 @@
.. _plugins: .. _plugins:
============ =======
Plugin Guide Plugins
============ =======
The emqttd broker could be extended by plugins. Users could develop plugins to customize authentication, ACL and functions of the broker, or integrate the broker with other systems. The emqttd broker could be extended by plugins. Users could develop plugins to customize authentication, ACL and functions of the broker, or integrate the broker with other systems.
@ -526,7 +526,26 @@ emqttd_plugin_template_app.erl - Register the auth/ACL modules:
Register Handlers for Hooks Register Handlers for Hooks
--------------------------- ---------------------------
The plugin could register handlers for hooks. The hooks will be called by the broker when a client connected/disconnected, a topic subscribed/unsubscribed or a message published/delivered. The plugin could register handlers for hooks. The hooks will be called by the broker when a client connected/disconnected, a topic subscribed/unsubscribed or a message published/delivered:
+------------------------+-------------+---------------------------------------+
| Name | Type | Description |
+------------------------+-------------+---------------------------------------+
| client.connected | foreach | Run when a client connected to the |
| | | broker successfully |
+------------------------+-------------+---------------------------------------+
| client.subscribe | foldl | Run before a client subscribes topics |
+------------------------+-------------+---------------------------------------+
| client.subscribe.after | foreach | Run after a client subscribed topics |
+------------------------+-------------+---------------------------------------+
| client.unsubscribe | foldl | Run when a client unsubscribes topics |
+------------------------+-------------+---------------------------------------+
| message.publish | foldl | Run when a message is published |
+------------------------+-------------+---------------------------------------+
| message.acked | foreach | Run when a message is delivered |
+------------------------+-------------+---------------------------------------+
| client.disconnected | foreach | Run when a client is disconnnected |
+----------------------- +-------------+---------------------------------------+
emqttd_plugin_template.erl for example:: emqttd_plugin_template.erl for example::
@ -554,27 +573,6 @@ emqttd_plugin_template.erl for example::
emqttd_broker:hook('message.acked', {?MODULE, on_message_acked}, emqttd_broker:hook('message.acked', {?MODULE, on_message_acked},
{?MODULE, on_message_acked, [Env]}). {?MODULE, on_message_acked, [Env]}).
Hook List:
+------------------------+-------------+---------------------------------------+
| Name | Type | Description |
+------------------------+-------------+---------------------------------------+
| client.connected | foreach | Run when a client connected to the |
| | | broker successfully |
+------------------------+-------------+---------------------------------------+
| client.subscribe | foldl | Run before a client subscribes topics |
+------------------------+-------------+---------------------------------------+
| client.subscribe.after | foreach | Run after a client subscribed topics |
+------------------------+-------------+---------------------------------------+
| client.unsubscribe | foldl | Run when a client unsubscribes topics |
+------------------------+-------------+---------------------------------------+
| message.publish | foldl | Run when a message is published |
+------------------------+-------------+---------------------------------------+
| message.acked | foreach | Run when a message is delivered |
+------------------------+-------------+---------------------------------------+
| client.disconnected | foreach | Run when a client is disconnnected |
+----------------------- +-------------+---------------------------------------+
Register CLI Modules Register CLI Modules
-------------------- --------------------