new JSJaCHttpPollingConnection
Instantiates an HTTP Polling session
- Source:
- JSJaCHttpPollingConnection.js, line 13
Extends
Members
-
oDbg :JSJaCDebugger
-
Reference to debugger interface (needs to implement method
log)- Source:
- JSJaCConnection.js, line 31
Methods
-
connect
-
Connect to a jabber/XMPP server.
Parameters:
Name Type Description oArgObject The configuration to be used for connecting. Properties
Name Type Argument Description domainstring The domain name of the XMPP service. usernamestring The username (nodename) to be logged in with. resourcestring The resource to identify the login with. passwordstring The user's password. allow_plainboolean <optional>
Whether to allow plain text logins. registerboolean <optional>
Whether to register a new account. hoststring <optional>
The host to connect to which might be different from the domain given above. So some XMPP service might host the domain 'example.com' but might be located at the host 'jabber.example.com'. Normally such situations should be gracefully handled by using DNS SRV records. But in cases where this isn't available you can set the host manually here. portint <optional>
The port of the manually given host from above. secureboolean <optional>
Whether to only allow secured (i.e. encrypted) connections to the XMPP service. authhoststring <optional>
The host that handles the actualy authorization. There are cases where this is different from the settings above, e.g. if there's a service that provides anonymous logins at 'anon.example.org'. authtypestring <optional>
Must be one of 'sasl' (default), 'nonsasl', 'saslanon', 'anonymous', or 'x-facebook-platform'. xmllangstring <optional>
The requested language for this login. Typically XMPP server try to respond with error messages and the like in this language if available. - Source:
- JSJaCConnection.js, line 115
-
connected
-
Tells whether this connection is connected
- Source:
- JSJaCConnection.js, line 217
Returns:
trueif this connections is connected,falseotherwise -
disconnect
-
Disconnects from jabber server and terminates session (if applicable)
- Source:
- JSJaCConnection.js, line 222
-
getPollInterval
-
Gets current value of polling interval
- Source:
- JSJaCConnection.js, line 258
Returns:
Polling interval in milliseconds -
isPolling
-
Tells whether this implementation of JSJaCConnection is polling Useful if it needs to be decided whether it makes sense to allow for adjusting or adjust the polling interval JSJaCConnection#setPollInterval
- Source:
- JSJaCHttpPollingConnection.js, line 34
Returns:
trueif this is a polling connection,falseotherwise. -
registerHandler
-
Registers an event handler (callback) for this connection.
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);Parameters:
Name Type Description eventString One of - onConnect - connection has been established and authenticated
- onDisconnect - connection has been disconnected
- onResume - connection has been resumed
- onStatusChanged - connection status has changed, current status as being passed argument to handler. See #status.
- onError - an error has occured, error node is supplied as
argument, like this:
<error code='404' type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error> - packet_in - a packet has been received (argument: the packet)
- packet_out - a packet is to be sent(argument: the packet)
- message_in | message - a message has been received (argument: the packet)
- message_out - a message packet is to be sent (argument: the packet)
- presence_in | presence - a presence has been received (argument: the packet)
- presence_out - a presence packet is to be sent (argument: the packet)
- iq_in | iq - an iq has been received (argument: the packet)
- iq_out - an iq is to be sent (argument: the packet)
childNameString A childnode's name that must occur within a retrieved packet [optional] childNSString A childnode's namespace that must occure within a retrieved packet (works only if childName is given) [optional] typeString 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] handlerFunction 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. - Source:
- JSJaCConnection.js, line 320
-
registerIQGet
-
Register for iq packets of type 'get'.
Parameters:
Name Type Description childNameString A childnode's name that must occur within a retrieved packet childNSString A childnode's namespace that must occure within a retrieved packet (works only if childName is given) handlerFunction 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. - Source:
- JSJaCConnection.js, line 396
-
registerIQSet
-
Register for iq packets of type 'set'.
Parameters:
Name Type Description childNameString A childnode's name that must occur within a retrieved packet childNSString A childnode's namespace that must occure within a retrieved packet (works only if childName is given) handlerFunction 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. - Source:
- JSJaCConnection.js, line 411
-
resume
-
Resumes this connection from saved state (cookie)
- Source:
- JSJaCConnection.js, line 421
Returns:
Whether resume was successful -
resumeFromData
-
Resumes BOSH connection from data
Parameters:
Name Type Description serializedObject jsjac state information - Source:
- JSJaCConnection.js, line 438
Returns:
Whether resume was successful -
send
-
Sends a JSJaCPacket
Parameters:
Name Type Description packetJSJaCPacket The packet to send cbFunction The callback to be called if there's a reply to this packet (identified by id) [optional] argObject Arguments passed to the callback (additionally to the packet received) [optional] - Source:
- JSJaCConnection.js, line 485
Returns:
'true' if sending was successfull, 'false' otherwise -
sendIQ
-
Sends an IQ packet. Has default handlers for each reply type. Those maybe overriden by passing an appropriate handler.
Parameters:
Name Type Description iqJSJaCIQPacket the iq packet to send handlersObject object with properties 'error_handler', 'result_handler' and 'default_handler' with appropriate functions argObject argument to handlers - Source:
- JSJaCConnection.js, line 529
Returns:
'true' if sending was successfull, 'false' otherwise -
setPollInterval
-
Sets polling interval for this connection
Parameters:
Name Type Description millisecsint Milliseconds to set timer to - Source:
- JSJaCConnection.js, line 562
Returns:
effective interval this connection has been set to -
status
-
Returns current status of this connection
- Source:
- JSJaCConnection.js, line 585
Returns:
String to denote current state. One of- 'initializing' ... well
- 'connecting' if connect() was called
- 'resuming' if resume() was called
- 'processing' if it's about to operate as normal
- 'onerror_fallback' if there was an error with the request object
- 'protoerror_fallback' if there was an error at the http binding protocol flow (most likely that's where you interested in)
- 'internal_server_error' in case of an internal server error
- 'suspending' if suspend() is being called
- 'aborted' if abort() was called
- 'disconnecting' if disconnect() has been called
-
suspend
-
Suspends this connection (saving state for later resume) Saves state to cookie
- Source:
- JSJaCConnection.js, line 593
Returns:
Whether suspend (saving to cookie) was successful -
suspendToData
-
Suspend connection and return serialized JSJaC connection state
- Source:
- JSJaCConnection.js, line 621
Returns:
JSJaC connection state object