Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eelco committed Dec 19, 2011
1 parent 83fdd48 commit 104ceb3
Showing 1 changed file with 8 additions and 41 deletions.
49 changes: 8 additions & 41 deletions README.markdown
Expand Up @@ -28,16 +28,14 @@ via a bosh-server and communicate willingly.

## Documentation for API ##

* Constructor: `Client(jid, password, bosh, route)`

Parameters:
*jid* : [String] jabber id of user (e.g. `user@example.com/office`)
*password* : [String] password
*bosh* : [String] url of the bosh-server (e.g. `http://localhost:5280/http-bind/`)
*route* : [String] route attribute [if used] for connecting to xmpp server
Return Value:
new Client Object having following properties:
* Constructor: `Client(jid, password, bosh, route)`
Parameters:
*jid* : [String] jabber id of user (e.g. `user@example.com/office`)
*password* : [String] password
*bosh* : [String] url of the bosh-server (e.g. `http://localhost:5280/http-bind/`)
*route* : [String] route attribute [if used] for connecting to xmpp server
Return Value:
new Client Object having following properties:

1. Event-emitter for the following events

Expand All @@ -57,87 +55,56 @@ via a bosh-server and communicate willingly.
stanza[Object] is the ltx xml element.

2. Function: `send(stanza)`

enqueues the stanza into the pending array to be sent to bosh-server on next Tick
parameters:
*stanza* : [Object] ltx xml Element object

3. Function: `sendMessage(to, body, type = "chat")`

sends a message 'body' to jid 'to' with type set to 'type'

parameters:
*to* : [String] jid of receiver(e.g. `myfriend@example.com/home`)
*body* : [String] message to be sent
*type* : [String] should only be among the permitted values of `type` for xmpp message stanza

4. Function: `disconnect()`

sends immediately any pending stanzas, ends the stream by sending terminate packet.

* Constructor `Element(xname, attrs)`

alias to ltx.Element Constructor

* Function: `$build(xname, attrs)`

an alias for `new ltx.Element(xname, attrs)`
Parameters:
*xname* : [string] name for the xml element
*attrs* : [Object] containing all the attributes to set up
Return value:
a new ltx.Element object

* Function: `$msg(attrs)`

an alias for `new ltx.Element("message", attrs)`
Parameters:
*attrs* : [Object] containing all the attributes to set up
Return value:
a new ltx.Element object

* Function: `$iq(attrs)`

an alias for `new ltx.Element("iq", attrs)`
Parameters:
attrs : [Object] containing all the attributes to set up
Return value:
a new ltx.Element object

* Function: `$pres(attrs)`

an alias for `new ltx.Element("presence", attrs)`
Parameters:
*attrs* : [Object] containing all the attributes to set up
Return value:
a new ltx.Element object

* Function: `setLogLevel(logLevel)`

sets the logLevel for module[use only when in serious problem i.e. debug mode]
Parameters:
*logLevel* : [String] permissible values:
*FATAL* : displays nothing [default]
*ERROR* : displays error messages
*INFO* : informs about important events
Expand Down

0 comments on commit 104ceb3

Please sign in to comment.