|
JSJaC | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--JSJaCConnection
Somewhat abstract base class for jabber connections. Contains all
of the code in common for all jabber connections
Defined in JSJaCConnection.js
Field Summary | |
Debugger |
oDbg
Reference to debugger interface (needs to implement method log ) |
Constructor Summary | |
JSJaCConnection(<JSON> oArg)
Creates a new Jabber connection (a connection to a jabber server) |
Method Summary | |
void
|
connect(oArg)
|
boolean
|
connected()
Tells whether this connection is connected |
void
|
disconnect()
Disconnects from jabber server and terminates session (if applicable) |
int
|
getPollInterval()
Gets current value of polling interval |
void
|
registerHandler(<String> event)
Registers an event handler (callback) for this connection. |
void
|
registerIQGet(<String> childName, <String> childNS, <Function> handler)
Register for iq packets of type 'get'. |
void
|
registerIQSet(<String> childName, <String> childNS, <Function> handler)
Register for iq packets of type 'set'. |
boolean
|
resume()
Resumes this connection from saved state (cookie) |
boolean
|
resumeFromData(data)
Resumes BOSH connection from data |
boolean
|
send(<JSJaCPacket> packet,<Function> cb,<Object> arg)
Sends a JSJaCPacket |
boolean
|
sendIQ(<JSJaCIQPacket> iq, <Object> handlers, <Object> arg)
Sends an IQ packet. |
int
|
setPollInterval(timerval)
Sets polling interval for this connection |
String
|
status()
Returns current status of this connection |
boolean
|
suspend()
Suspends this connection (saving state for later resume) Saves state to cookie |
Object
|
suspendToData()
Suspend connection and return serialized JSJaC connection state |
void
|
unregisterHandler(event,handler)
|
Field Detail |
Debugger oDbg
log
)
Constructor Detail |
JSJaCConnection(<JSON> oArg)
oArg
- JSON with properties: httpbase
the http base address of the service to be used for connecting to jabberoDbg
(optional) a reference to a debugger interface
Method Detail |
void connect(oArg)
boolean connected()
true
if this connections is connected, false
otherwise
void disconnect()
int getPollInterval()
void registerHandler(<String> event)
Note: All of the packet handlers for specific packets (like
message_in, presence_in and iq_in) fire only if there's no
callback associated with the id.
Example:
con.registerHandler('iq', 'query', 'jabber:iq:version', handleIqVersion);
event
- One of <error code='404' type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
childName
- A childnode's name that must occur within a retrieved packet [optional]
childNS
- A childnode's namespace that must occure within a retrieved packet (works only if childName is given) [optional]
type
- The type of the packet to handle (works only if childName and chidNS are given (both may be set to '*' in order to get skipped) [optional]
handler
- The handler to be called when event occurs. If your handler returns 'true' it cancels bubbling of the event. No other registered handlers for this event will be fired.
void registerIQGet(<String> childName, <String> childNS, <Function> handler)
childName
- A childnode's name that must occur within a retrieved packet
childNS
- A childnode's namespace that must occure within a retrieved packet (works only if childName is given)
handler
- The handler to be called when event occurs. If your handler returns 'true' it cancels bubbling of the event. No other registered handlers for this event will be fired.
void registerIQSet(<String> childName, <String> childNS, <Function> handler)
childName
- A childnode's name that must occur within a retrieved packet
childNS
- A childnode's namespace that must occure within a retrieved packet (works only if childName is given)
handler
- The handler to be called when event occurs. If your handler returns 'true' it cancels bubbling of the event. No other registered handlers for this event will be fired.
boolean resume()
boolean resumeFromData(data)
serialized
- jsjac state information
boolean send(<JSJaCPacket> packet,<Function> cb,<Object> arg)
packet
- The packet to send
cb
- The callback to be called if there's a reply to this packet (identified by id) [optional]
arg
- Arguments passed to the callback (additionally to the packet received) [optional]
boolean sendIQ(<JSJaCIQPacket> iq, <Object> handlers, <Object> arg)
iq
- - the iq packet to send
handlers
- - object with properties 'error_handler', 'result_handler' and 'default_handler' with appropriate functions
arg
- - argument to handlers
int setPollInterval(timerval)
millisecs
- Milliseconds to set timer to
String status()
boolean suspend()
Object suspendToData()
void unregisterHandler(event,handler)
|
JSJaC | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |