Package | org.igniterealtime.xiff.core |
Class | public class XMPPBOSHConnection |
Inheritance | XMPPBOSHConnection ![]() ![]() |
Implements | IXMPPConnection |
Using BOSH does not prevent your application from respecting
Adobe Flash Player policy file issues. HTTP requests to your
server must be authorized with a crossdomain.xml
file
in your webserver root.
Warning: if you are using BOSH through HTTPS, your crossdomain policy file must also be served through HTTPS. Your application (if online) must also be served through HTTPS else you will have a crossdomain policy issue. This issue can be solved by using the secure property of the allow-access-from node in the crossdomain.xml file. But this is not recommended by Adobe.
If your crossdomain policy file cannot
be served by your server, this issue could be solved with an
Apache proxy redirect so that any automatic Flash/Flex calls
to an URL like http://xmppserver:5280/crossdomain.xml
will be
redirected as an URL of your choice such as
http://webserver/crossdomain.xml
.
See also
Property | Defined By | ||
---|---|---|---|
![]() | active : Boolean
Determines whether the connection with the server is currently active. | XMPPConnection | |
boshPath : String
Local part of the address in which the server responds. | XMPPBOSHConnection | ||
![]() | compress : Boolean
Shall the Stream Compression be allowed if the server supports it. | XMPPConnection | |
![]() | compressor : ICompressor
The class that is to be used for Stream Compression if enabled. | XMPPConnection | |
![]() | domain : String
The XMPP domain to use with the server. | XMPPConnection | |
hold : uint
This attribute specifies the maximum number of requests the connection
manager is allowed to keep waiting at any one time during the session. | XMPPBOSHConnection | ||
httpServer : String [read-only]
Server URI
| XMPPBOSHConnection | ||
![]() | incomingBytes : uint [read-only]
Get the total count of the received bytes in the current session. | XMPPConnection | |
![]() | jid : UnescapedJID [read-only]
Gets the fully qualified unescaped JID of the user. | XMPPConnection | |
![]() | loggedIn : Boolean
Determines whether the user is connected and logged into the server. | XMPPConnection | |
maxConcurrentRequests : uint
Defaults to 2. | XMPPBOSHConnection | ||
![]() | openConnections : Array [static] [read-only]
Reference to all active connections. | XMPPConnection | |
![]() | outgoingBytes : uint [read-only]
Get the total count of the bytes sent in the current session. | XMPPConnection | |
![]() | password : String
The password to use when logging in. | XMPPConnection | |
![]() | port : uint
The port to use when connecting. | XMPPConnection | |
![]() | queuePresences : Boolean
Should the connection queue presence events for a small interval so that it can
send multiple in a batch?
| XMPPConnection | |
![]() | registrationSupported : Boolean [read-only]
Does the connection support registration. | XMPPConnection | |
![]() | resource : String
The resource to use when logging in. | XMPPConnection | |
secure : Boolean
HTTP bind requests type. | XMPPBOSHConnection | ||
![]() | server : String
The XMPP server to use for connection. | XMPPConnection | |
![]() | useAnonymousLogin : Boolean
Whether to use anonymous login or not. | XMPPConnection | |
![]() | username : String
The username to use for connection. | XMPPConnection | |
wait : uint
This attribute specifies the longest time (in seconds) that the connection
manager is allowed to wait before responding to any request during the session. | XMPPBOSHConnection |
Method | Defined By | ||
---|---|---|---|
XMPPBOSHConnection(secure:Boolean = false)
TLS compression (as defined in RFC 3920) and Stream Compression (as defined
in Stream Compression [XEP-0138]) are NOT RECOMMENDED in BOSH since compression
SHOULD be negotiated at the HTTP layer using the 'accept' attribute
of the BOSH session creation response. | XMPPBOSHConnection | ||
connect(streamType:uint = 0):void [override]
The first request from the client to the connection manager requests a new session. | XMPPBOSHConnection | ||
![]() | disableExtensions(... exts):void
Disable the given extensions from the registery. | XMPPConnection | |
![]() | disableSASLMechanism(name:String):void
Remove a SASL mechanism from this connection
| XMPPConnection | |
disconnect():void [override]
| XMPPBOSHConnection | ||
![]() | enableExtensions(... exts):void
Enable the given extensions for interacting with the incoming data. | XMPPConnection | |
![]() | enableSASLMechanism(name:String, authClass:Class):void
Add a SASL mechanism available for this connection
| XMPPConnection | |
pauseSession(seconds:uint):Boolean | XMPPBOSHConnection | ||
processConnectionResponse(responseBody:XML):void
Session Creation Response
After receiving a new session request, the connection manager MUST generate
an opaque, unpredictable session identifier (or SID). | XMPPBOSHConnection | ||
![]() | send(data:IXMPPStanza):void
Sends data to the server. | XMPPConnection | |
sendKeepAlive():void [override]
Does nothing, BOSH uses polling instead. | XMPPBOSHConnection |
Method | Defined By | ||
---|---|---|---|
![]() | beginAuthentication():void
SASL Authentication should been set up, begin the authentication
process by sending the initial request. | XMPPConnection | |
![]() | bindConnection():void
Upon being so informed that resource binding is required, the client
MUST bind a resource to the stream by sending to the server an IQ
stanza of type "set" (see IQ Semantics (Section 9.2.3)) containing
data qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace. | XMPPConnection | |
![]() | checkIncomingData(bytedata:ByteArray):XML
Check if the incoming data is complete once added to any existing
incoming data. | XMPPConnection | |
![]() | chooseStreamTags(type:uint):void
Choose the stream start and ending tags based on the given type. | XMPPConnection | |
![]() | configureAuthMechanisms(mechanisms:XML):void
Use the authentication which is first in the list (saslMechanisms) if possible. | XMPPConnection | |
![]() | configureStreamCompression(method:String = zlib):void
Zlib is the most common and the one which is required to be implemented in case
Stream Compression is used. | XMPPConnection | |
![]() | createConnection():void
Set up the connection and listeners related to this class. | XMPPConnection | |
![]() | dispatchError(condition:String, message:String, type:String, code:int = 0, extension:Extension = null):void | XMPPConnection | |
![]() | establishSession():void
Runs after binding
| XMPPConnection | |
![]() | flushPresenceQueue(event:TimerEvent):void
Dispatches a single PresenceEvent in case there are any in the
queue. | XMPPConnection | |
![]() | handleAuthentication(response:XML):void
Upon receiving a success indication within the SASL negotiation, the
client MUST send a new stream header to the server, to which the
server MUST respond with a stream header as well as a list of
available stream features. | XMPPConnection | |
![]() | handleMessage(node:XML):void
TODO: Add similar extension handling as in IQ,
after message specific extensions are separated from Message class, v3.2.0
| XMPPConnection | |
handleNodeType(node:XML):void [override]
TODO: Is this somthing that could be safely removed?
| XMPPBOSHConnection | ||
![]() | handlePresence(node:XML):Presence
Handle the incoming Presence either with the queue timer or directly
dispatching the PresenceEvent. | XMPPConnection | |
![]() | handleStream(node:XML):void
Initial stream element has been received once this method is called. | XMPPConnection | |
![]() | handleStreamError(node:XML):void
Handle stream error related element. | XMPPConnection | |
![]() | handleStreamFeatures(node:XML):void
Handle features that are available in the connected server. | XMPPConnection | |
![]() | handleStreamTLS(node:XML):void
Checks if the TLS feature available is required or not and dispatches
an error in case it is. | XMPPConnection | |
![]() | onIOError(event:IOErrorEvent):void
This fires the standard dispatchError method
| XMPPConnection | |
![]() | parseDataReceived(bytedata:ByteArray):void
Parses the data which the socket just received. | XMPPConnection | |
![]() | removeSocketEventListeners():void
Remove those listeners that the createConnection method added. | XMPPConnection | |
restartStream():void [override]
Upon receiving the success element, the client
MUST then ask the connection manager to restart the stream by
sending a "restart request". | XMPPBOSHConnection | ||
![]() | sendData(data:String):void
Dispatches OutgoingDataEvent, handles possible Stream Compression and
calls sendDataToServer. | XMPPConnection | |
sendDataToServer(data:ByteArray):void [override]
Connection to the server in BOSH is a simple URLRequest. | XMPPBOSHConnection | ||
sendXML(data:String):void [override]
Pass through to sendRequests method for having the
body wrapper around the given data. | XMPPBOSHConnection | ||
![]() | serviceDiscoveryResponce(to:EscapedJID, id:String):void
Send a response to the Service Discovery query. | XMPPConnection |
Constant | Defined By | ||
---|---|---|---|
BOSH_NS : String = http://jabber.org/protocol/httpbind [static]
Namespace used by BOSH body wrapper
| XMPPBOSHConnection | ||
BOSH_VERSION : String = 1.6 [static]
Current version of the BOSH defined in the XEP and the
version which this class implements. | XMPPBOSHConnection | ||
ELEMENT_NAME : String = body [static]
BOSH body wrapper element name
| XMPPBOSHConnection | ||
HTTP_PORT : uint = 7070 [static]
The default port as per XMPP specification. | XMPPBOSHConnection | ||
HTTPS_PORT : uint = 7443 [static]
The default secure port as per XMPP specification. | XMPPBOSHConnection | ||
![]() | STREAM_TYPE_FLASH : uint = 2 [static]
Stream type lets user set opening/closing tag. | XMPPConnection | |
![]() | STREAM_TYPE_FLASH_TERMINATED : uint = 3 [static]
Stream type lets user set opening/closing tag. | XMPPConnection | |
![]() | STREAM_TYPE_STANDARD : uint = 0 [static]
Stream type lets user set opening/closing tag. | XMPPConnection | |
![]() | STREAM_TYPE_STANDARD_TERMINATED : uint = 1 [static]
Stream type lets user set opening/closing tag. | XMPPConnection |
boshPath | property |
boshPath:String
Local part of the address in which the server responds.
The default value is http-bind/
.
public function get boshPath():String
public function set boshPath(value:String):void
hold | property |
hold:uint
This attribute specifies the maximum number of requests the connection manager is allowed to keep waiting at any one time during the session. If the client is not able to use HTTP Pipelining then this SHOULD be set to "1".
public function get hold():uint
public function set hold(value:uint):void
httpServer | property |
httpServer:String
[read-only] Server URI
public function get httpServer():String
maxConcurrentRequests | property |
maxConcurrentRequests:uint
Defaults to 2. Value retrieved from the server once stream is initiating.
public function get maxConcurrentRequests():uint
public function set maxConcurrentRequests(value:uint):void
secure | property |
secure:Boolean
HTTP bind requests type. If secure, the requests will be sent through HTTPS. If not, through HTTP.
Please note that the port
needs to be set separately.
public function get secure():Boolean
public function set secure(value:Boolean):void
wait | property |
wait:uint
This attribute specifies the longest time (in seconds) that the connection manager is allowed to wait before responding to any request during the session. This enables the client to limit the delay before it discovers any network failure, and to prevent its HTTP/TCP connection from expiring due to inactivity.
public function get wait():uint
public function set wait(value:uint):void
XMPPBOSHConnection | () | Constructor |
public function XMPPBOSHConnection(secure:Boolean = false)
TLS compression (as defined in RFC 3920) and Stream Compression (as defined in Stream Compression [XEP-0138]) are NOT RECOMMENDED in BOSH since compression SHOULD be negotiated at the HTTP layer using the 'accept' attribute of the BOSH session creation response.
TLS compression and Stream Compression SHOULD NOT be used at the same time as HTTP content encoding.
Parameterssecure:Boolean (default = false ) — Determines which port is used
|
connect | () | method |
override public function connect(streamType:uint = 0):void
The first request from the client to the connection manager requests a new session.
The body element of the first request SHOULD possess the following attributes (they SHOULD NOT be included in any other requests except as specified under Adding Streams To A Session):
Note: Clients that only support Polling Sessions MAY prevent the connection manager from waiting by setting 'wait' or 'hold' to "0". However, polling is NOT RECOMMENDED since the associated increase in bandwidth consumption and the decrease in responsiveness are both typically one or two orders of magnitude!
Parameters
streamType:uint (default = 0 ) — Not used
|
See also
disconnect | () | method |
override public function disconnect():void
See also
handleNodeType | () | method |
override protected function handleNodeType(node:XML):void
TODO: Is this somthing that could be safely removed?
Parameters
node:XML |
pauseSession | () | method |
public function pauseSession(seconds:uint):Boolean
Parameters
seconds:uint |
Boolean — true if pause request is sent
|
processConnectionResponse | () | method |
public function processConnectionResponse(responseBody:XML):void
Session Creation Response
After receiving a new session request, the connection manager MUST generate an opaque, unpredictable session identifier (or SID). The SID MUST be unique within the context of the connection manager application. The body element of the connection manager's response to the client's session creation request MUST possess the following attributes (they SHOULD NOT be included in any other responses):
The body element SHOULD also include the following attributes (they SHOULD NOT be included in any other responses):
The connection manager MAY include an 'accept' attribute in the session creation response element, to specify a space-separated list of the content encodings it can decompress. After receiving a session creation response with an 'accept' attribute, clients MAY include an HTTP Content-Encoding header in subsequent requests (indicating one of the encodings specified in the 'accept' attribute) and compress the bodies of the requests accordingly.
Parameters
responseBody:XML |
See also
restartStream | () | method |
override protected function restartStream():void
Upon receiving the success element, the client MUST then ask the connection manager to restart the stream by sending a "restart request".
sendDataToServer | () | method |
override protected function sendDataToServer(data:ByteArray):void
Connection to the server in BOSH is a simple URLRequest.
All information is encoded in the body of standard HTTP POST requests and responses. Each HTTP body contains a single body wrapper which encapsulates the XML elements being transferred.
BOSH requires all incoming and outgoing data to be wrapped in
body
element. That should be taken care of before possible
Stream Compression.
Parameters
data:ByteArray — ByteArray that might be compressed if enabled
|
See also
sendKeepAlive | () | method |
override public function sendKeepAlive():void
Does nothing, BOSH uses polling instead.
sendXML | () | method |
override protected function sendXML(data:String):void
Pass through to sendRequests
method for having the
body
wrapper around the given data.
Parameters
data:String |
BOSH_NS | Constant |
public static const BOSH_NS:String = http://jabber.org/protocol/httpbind
Namespace used by BOSH body wrapper
BOSH_VERSION | Constant |
public static const BOSH_VERSION:String = 1.6
Current version of the BOSH defined in the XEP and the version which this class implements.
The default value is 1.6
.
ELEMENT_NAME | Constant |
public static const ELEMENT_NAME:String = body
BOSH body wrapper element name
HTTP_PORT | Constant |
public static const HTTP_PORT:uint = 7070
The default port as per XMPP specification.
The default value is 7070
.
HTTPS_PORT | Constant |
public static const HTTPS_PORT:uint = 7443
The default secure port as per XMPP specification.
The default value is 7443
.