1803
|
1 ---
|
|
2 labels:
|
|
3 - 'Stage-Beta'
|
|
4 summary: 'MQTT interface to Prosody''s pubsub'
|
|
5 ...
|
|
6
|
|
7 Introduction
|
|
8 ------------
|
|
9
|
|
10 [MQTT](http://mqtt.org/) is a lightweight binary pubsub protocol suited
|
|
11 to embedded devices. This module provides a way for MQTT clients to
|
|
12 connect to Prosody and publish or subscribe to local pubsub nodes.
|
|
13
|
|
14 Details
|
|
15 -------
|
|
16
|
|
17 MQTT has the concept of 'topics' (similar to XMPP's pubsub 'nodes').
|
|
18 mod\_pubsub\_mqtt maps pubsub nodes to MQTT topics of the form
|
|
19 `HOST/NODE', e.g.`pubsub.example.org/mynode\`.
|
|
20
|
|
21 ### Limitations
|
|
22
|
|
23 The current implementation is quite basic, and in particular:
|
|
24
|
|
25 - Authentication is not supported
|
|
26 - SSL/TLS is not supported
|
|
27 - Only QoS level 0 is supported
|
|
28
|
|
29 ### Payloads
|
|
30
|
|
31 XMPP payloads are always XML, but MQTT does not define a payload format.
|
|
32 Therefore mod\_pubsub\_mqtt will attempt to convert data of certain
|
|
33 recognised payload types. Currently supported:
|
|
34
|
|
35 - JSON (see [XEP-0335](http://xmpp.org/extensions/xep-0335.html) for
|
|
36 the format)
|
|
37 - Plain UTF-8 text (wrapped inside
|
|
38 `<data xmlns="https://prosody.im/protocol/mqtt"/>`)
|
|
39
|
|
40 All other XMPP payload types are sent to the client directly as XML.
|
|
41 Data published by MQTT clients is currently never translated, and always
|
|
42 treated as UTF-8 text.
|
|
43
|
|
44 Configuration
|
|
45 -------------
|
|
46
|
|
47 There is no special configuration for this module. Simply load it on
|
|
48 your pubsub host like so:
|
|
49
|
|
50 Component "pubsub.example.org" "pubsub"
|
|
51 modules_enabled = { "pubsub_mqtt" }
|
|
52
|
|
53 You may also configure which port(s) mod\_pubsub\_mqtt listens on using
|
|
54 Prosody's standard config directives, such as `mqtt_ports`. Network
|
|
55 settings **must** be specified in the global section of the config file,
|
|
56 not under any particular pubsub component. The default port is 1883
|
|
57 (MQTT's standard port number).
|
|
58
|
|
59 Compatibility
|
|
60 -------------
|
|
61
|
|
62 ------- --------------
|
|
63 trunk Works
|
|
64 0.9 Works
|
|
65 0.8 Doesn't work
|
|
66 ------- --------------
|