Home

# Class goog.net.xpc.IframePollingTransport

Iframe polling transport. Uses hidden iframes to transfer data in the fragment identifier of the URL. The peer polls the iframe's location for changes. Unfortunately, in Safari this screws up the history, because Safari doesn't allow to call location.replace() on a window containing a document from a different domain (last version tested: 2.0.4).

extends goog.net.xpc.Transport

Instance Method Summary
| `checkForeignFramesReady_()` Checks if the frames in the peer's page are ready. These contain a document from the own domain and are the ones messages are received through.
| `checkIfConnected_()` Check if connection is ready.
| `checkLocalFramesPresent_()` Checks if the iframes created in the own document are ready.
| `connect()` Connects this transport.
| `constructSenderFrame_(string id) ⇒ ?Element` Constructs a sending frame the the given id.
| `constructSenderFrames_()` Creates the iframes which are used to send messages (and acknowledgements) to the peer. Sender iframes contain a document from a different origin and therefore their content can't be accessed.
| `deconstructSenderFrames_()` Cleans up the existing sender frames owned by this peer. Only called by the outer peer.
| `deliverPayload_(string s)` Delivers a message.

`disposeInternal()`

Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:

    mypackage.MyClass = function() {
    goog.base(this);
    // Constructor logic specific to MyClass.
    ...
    };
    goog.inherits(mypackage.MyClass, goog.Disposable);

    mypackage.MyClass.prototype.disposeInternal = function() {
    goog.base(this, 'disposeInternal');
    // Dispose logic specific to MyClass.
    ...
    };

| `getAckFrameName_() ⇒ string` Returns the name/ID of the ack frame.
| `getMsgFrameName_() ⇒ string` Returns the name/ID of the message frame.

`innerPeerReconnect_()`

The protocol for reconnecting is for the inner frame to change channel names, and then communicate the new channel name to the outer peer. The outer peer looks in a predefined location for the channel name upate. It is important to use a completely new channel name, as this will ensure that all messaging iframes are not in the bfcache. Otherwise, Safari may pollute the history when modifying the location of bfcached iframes.

| `isRcvFrameReady_(string frameName) ⇒ boolean` Checks if the receiving frame is ready.
| `outerPeerReconnect_()` Scans inner peer for a reconnect message, which will be used to update the outer peer's channel name. If a reconnect message is found, the sender frames will be cleaned up to make way for the new sender frames. Only called by the outer peer.
| `processIncomingAck(string msgStr)` Process an incoming acknowdedgement.
| `processIncomingMsg(string raw)` Processes an incoming message.
| `send(string service, string payload)` Sends a message. Splits it in multiple frames if too long (exceeds IE's URL-length maximum. Wireformat: <seq>[,<frame_no>/<#frames>]|<frame_content>
| `sendNextFrame_()` Sends a frame (message part).

Static Method Summary
| `receive_()` Polls all receivers.
| `startRcvTimer_()` Starts the polling loop.