Mercurial > prosodywiki
annotate mod_json_streams.wiki @ 176:8426db59abf0
mod_json_streams: Grammar.
author  Waqas Hussain <waqas20@gmail.com> 

date  Sat, 02 Apr 2011 06:15:02 +0500 
parents  01fb5e97f22b 
children 
rev  line source 

173
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

1 #summary JSON Encodings for XMPP 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

2 #labels StageBeta 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

3 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

4 = Introduction = 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

5 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

6 This plugin encodes XMPP as JSON. This is an implementation of [http://xmpp.org/extensions/xep0295.html XEP0295: JSON Encodings for XMPP]. 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

7 
176
8426db59abf0
mod_json_streams: Grammar.
Waqas Hussain <waqas20@gmail.com>
parents:
175
diff
changeset

8 Simply loading this module makes Prosody accept JSON on C2S streams (legacy XML clients are still supported). 
173
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

9 
176
8426db59abf0
mod_json_streams: Grammar.
Waqas Hussain <waqas20@gmail.com>
parents:
175
diff
changeset

10 For BOSH, it requires mod_bosh be loaded, and JSON should be directed at the `/jsonstreams` HTTP path. 
173
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

11 
174
c87bea8ab41a
mod_json_streams: Some tweaks and fixes.
Waqas Hussain <waqas20@gmail.com>
parents:
173
diff
changeset

12 JSON for S2S isn't supported due to the lack of a discovery mechanism, so we have left that disabled to stay compatible with legacy XML servers. 
173
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

13 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

14 = Configuration = 
174
c87bea8ab41a
mod_json_streams: Some tweaks and fixes.
Waqas Hussain <waqas20@gmail.com>
parents:
173
diff
changeset

15 Just add `"json_streams"` in your config's global `modules_enabled` list, for example: 
173
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

16 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

17 {{{ 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

18 modules_enabled = { 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

19 ... 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

20 "json_streams"; 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

21 } 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

22 }}} 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

23 
175
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

24 = Strophe.js plugin = 
176
8426db59abf0
mod_json_streams: Grammar.
Waqas Hussain <waqas20@gmail.com>
parents:
175
diff
changeset

25 We also developed a [http://prosodymodules.googlecode.com/hg/mod_json_streams/strophe.jsonstreams.js JSON streams plugin] for the popular [http://code.stanziq.com/strophe strophe.js] library. 
175
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

26 
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

27 Just include it like this after including the strophe library, and your strophebased client will be speaking JSON: 
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

28 {{{ 
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

29 <script type="text/javascript" src="strophe.jsonstreams.js"></script> 
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

30 }}} 
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

31 Be sure to set the HTTP path to `/jsonstreams`. No other changes are required. 
01fb5e97f22b
mod_json_streams: Added section for strophe.js plugin.
Waqas Hussain <waqas20@gmail.com>
parents:
174
diff
changeset

32 
173
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

33 = Compatibility = 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

34 0.8Works 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

35 trunkWorks 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

36 
e613d82d097a
mod_json_streams: Some documentation.
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset

37 = Quirks = 
176
8426db59abf0
mod_json_streams: Grammar.
Waqas Hussain <waqas20@gmail.com>
parents:
175
diff
changeset

38 * This plugin does not currently work with Prosody's [http://prosody.im/doc/port_multiplexing port multiplexing] feature 