net.xpc.IframePollingTransport Extends goog.net.xpc.Transport
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).

Inheritance

Constructor

goog.net.xpc.IframePollingTransport(channelopt_domHelper)

Parameters

channel : goog.net.xpc.CrossPageChannel
The channel this transport belongs to.
opt_domHelper : goog.dom.DomHelper=
The dom helper to use for finding the correct window.

Instance Methods

Public Protected Private
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.
code »
checkIfConnected_()
Check if connection is ready.
code »
checkLocalFramesPresent_()
Checks if the iframes created in the own document are ready.
code »
connect()
Connects this transport.
code »
constructSenderFrame_(id) !Element
Constructs a sending frame the the given id.
Arguments:
id : string
The id.
Returns: !Element  The constructed frame.
code »
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.
code »
deconstructSenderFrames_()
Cleans up the existing sender frames owned by this peer. Only called by the outer peer.
code »
deliverPayload_(s)
Delivers a message.
Arguments:
s : string
The complete message string (":").
code »
disposeInternal()
No description.
code »
getAckFrameName_() string
Returns the name/ID of the ack frame.
Returns: string  Name of ack frame.
code »
getMsgFrameName_() string
Returns the name/ID of the message frame.
Returns: string  Name of message frame.
code »
getPeerFrame_(frameName) !Window
Safely retrieves the peer frame with the specified name.
Arguments:
frameName : string
The name of the peer frame to retrieve.
Returns: !Window  The peer frame with the specified name.
code »
getPeerFrames_() !Object.<!Window>
Safely retrieves the frames from the peer window. If an error is thrown (e.g. the window is closing) an empty frame object is returned.
Returns: !Object.<!Window>  The frames from the peer window.
code »
isChannelAvailable() boolean
Determines whether the channel is still available. The channel is unavailable if the transport was disposed or the peer is no longer available.
Returns: boolean  Whether the channel is available.
code »
isRcvFrameReady_(frameName) boolean
Checks if the receiving frame is ready.
Arguments:
frameName : string
Which receiving frame to check.
Returns: boolean  Whether the receiving frame is ready.
code »
maybeInnerPeerReconnect_()
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.
code »
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.
code »
processIncomingAck(msgStr)
Process an incoming acknowdedgement.
Arguments:
msgStr : string
The incoming ack string to process.
code »
processIncomingMsg(raw)
Processes an incoming message.
Arguments:
raw : string
The complete received string.
code »
send(servicepayload)
Sends a message. Splits it in multiple frames if too long (exceeds IE's URL-length maximum. Wireformat: [,/<#frames>]|
Arguments:
service : string
Name of service this the message has to be delivered.
payload : string
The message content.
code »
sendNextFrame_()
Sends a frame (message part).
code »
getName() string
Return the transport name.
Returns: string  the transport name.
code »
getType() number
No description.
Returns: number  The transport type identifier.
code »
getWindow() !Window
Returns the window associated with this transport instance.
Returns: !Window  The window to use.
code »
send(servicepayload)
Sends a message.
Arguments:
service : string
The name off the service the message is to be delivered to.
payload : string
The message content.
code »
transportServiceHandler(payload)
Handles transport service messages (internal signalling).
Arguments:
payload : string
The message content.
code »
addOnDisposeCallback(callbackopt_scope)
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
Arguments:
callback : function(this:T):?
The callback function.
opt_scope : T=
An optional scope to call the callback in.
code »
dispose() void
Disposes of the object. If the object hasn't already been disposed of, calls #disposeInternal. Classes that extend goog.Disposable should override #disposeInternal in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void  Nothing.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend goog.Disposable should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' disposeInternal method. Everywhere else the public dispose method must be used. For example:
  mypackage.MyClass = function() {
    mypackage.MyClass.base(this, 'constructor');
    // Constructor logic specific to MyClass.
    ...
  };
  goog.inherits(mypackage.MyClass, goog.Disposable);

  mypackage.MyClass.prototype.disposeInternal = function() {
    // Dispose logic specific to MyClass.
    ...
    // Call superclass's disposeInternal at the end of the subclass's, like
    // in C++, to avoid hard-to-catch issues.
    mypackage.MyClass.base(this, 'disposeInternal');
  };
code »
getDisposed() boolean
Use #isDisposed instead. No description.
Returns: boolean  Whether the object has been disposed of.
code »
isDisposed() boolean
No description.
Returns: boolean  Whether the object has been disposed of.
code »
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed together.
Arguments:
disposable : goog.disposable.IDisposable
that will be disposed when this object is disposed.
code »

Instance Properties

MAX_FRAME_LENGTH_ :
Maximal frame length.
Code »
The channel this transport belongs to.
Code »
constructor :
No description.
Code »
initialized_ :
Flag indicating if channel has been initialized.
Code »
pollsBeforeReconnect_ :
The number of times the inner frame will check for evidence of the outer frame before it tries its reconnection sequence. These occur at 100ms intervals, making this an effective max waiting period of 500ms.
Code »
rcvUri_ :
The URI which is polled for incoming messages.
Code »
reconnectFrame_ :
Reconnection iframe created by inner peer.
Code »
sendQueue_ :
The queue to hold messages which can't be sent immediately.
Code »
sendUri_ :
The URI used to send messages.
Code »
sequence_ :
Sequence counter.
Code »
transportType :
The transport type.
Code »
waitForAck_ :
Flag indicating whether we are waiting for an acknoledgement.
Code »
connect :
Connects this transport. The transport implementation is expected to call CrossPageChannel.prototype.notifyConnected when the channel is ready to be used.
Code »
constructor :
No description.
Code »
domHelper_ : goog.dom.DomHelper
The dom helper to use for finding the window objects to reference.
Code »
transportType :
The transport type.
Code »
creationStack :
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Code »
disposed_ :
Whether the object has been disposed of.
Code »
onDisposeCallbacks_ :
Callbacks to invoke when this object is disposed.
Code »

Static Methods

goog.net.xpc.IframePollingTransport.receive_()
Polls all receivers.
code »
goog.net.xpc.IframePollingTransport.startRcvTimer_()
Starts the polling loop.
code »

Static Properties

goog.net.xpc.IframePollingTransport.IFRAME_PREFIX :
The string used to prefix all iframe names and IDs.
Code »
goog.net.xpc.IframePollingTransport.TIME_POLL_LONG_ :
Long polling interval.
Code »
goog.net.xpc.IframePollingTransport.TIME_POLL_SHORT_ :
Short polling interval.
Code »
goog.net.xpc.IframePollingTransport.TIME_SHORT_POLL_AFTER_ACTIVITY_ :
Period how long to use TIME_POLL_SHORT_ before raising polling-interval to TIME_POLL_LONG_ after an activity.
Code »
goog.net.xpc.IframePollingTransport.lastActivity_ :
No description.
Code »
goog.net.xpc.IframePollingTransport.rcvTimer_ :
No description.
Code »
goog.net.xpc.IframePollingTransport.receiveCb_ :
Callback that wraps receive_ to be used in timers.
Code »
goog.net.xpc.IframePollingTransport.receivers_ :
Array holding all Receiver-instances.
Code »
goog.net.xpc.IframePollingTransport.superClass_ :
No description.
Code »

Package net.xpc

Package Reference