net.xpc.DirectTransport Extends goog.net.xpc.Transport
A direct window to window method transport. If the windows are in the same security context, this transport calls directly into the other window without using any additional mechanism. This is mainly used in scenarios where you want to optionally use a cross domain transport in cross security context situations, or optionally use a direct transport in same security context situations. Note: Global properties are exported by using this transport. One to communicate with the other window by, currently crosswindowmessaging.channel, and by using goog.getUid on window, currently closure_uid_[0-9]+.

Inheritance

Constructor

goog.net.xpc.DirectTransport(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/document. If omitted, uses the current document.

Instance Methods

Public Protected Private
connect()
No description.
code »
disposeInternal()
No description.
code »
executeScheduledSend_(message)
Sends the message.
Arguments:
message : !DirectTransport.Message_
The message to send.
code »
getPeerRole_() goog.net.xpc.CrossPageChannelRole
No description.
Returns: goog.net.xpc.CrossPageChannelRole  The role of peer channel (either inner or outer).
code »
maybeAttemptToConnect_()
Connects to other peer. In the case of the outer peer, the setup messages are likely sent before the inner peer is ready to receive them. Therefore, this function will continue trying to send the SETUP message until the inner peer responds. In the case of the inner peer, it will occasionally have its channel name fall out of sync with the outer peer, particularly during soft-reloads and history navigations.
code »
notifyConnected_()
Notifies the channel that this transport is connected.
code »
send(servicepayload)
Prepares to send a message.
Arguments:
service : string
The name of the service the message is to be delivered to.
payload : string
The message content.
code »
sendSetupAckMessage_()
Sends a SETUP_ACK transport service message.
code »
sendSetupMessage_()
Sends a SETUP transport service message.
code »
transportServiceHandler(payload)
Handles transport service messages.
Arguments:
payload : string
The message content.
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

asyncSendsMap_ :
The map of sending messages.
Code »
The channel this transport belongs to.
Code »
connected_ : goog.async.Deferred
Fires once we're marked connected.
Code »
constructor :
No description.
Code »
endpointId_ :
The unique ID of this side of the connection. Used to determine when a peer is reloaded.
Code »
eventHandler_ : goog.events.EventHandler
No description.
Code »
initialized_ :
Flag indicating if this instance of the transport has been initialized.
Code »
maybeAttemptToConnectTimer_ : goog.Timer
Timer for connection reattempts.
Code »
originalChannelName_ :
The original channel name.
Code »
peerEndpointId_ :
The unique ID of the peer. If we get a message from a peer with an ID we don't expect, we reset the connection.
Code »
setupAckReceived_ : goog.async.Deferred
Fires once we've received our SETUP_ACK message.
Code »
setupAckSent_ : goog.async.Deferred
Fires once we've sent our SETUP_ACK message.
Code »
transportType :
The transport type.
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.DirectTransport.getRoledChannelName_(channelNamerole) string
No description.
Arguments:
channelName : string
The channel name.
role : string | number
The role.
Returns: string  The formatted channel name including role.
code »
goog.net.xpc.DirectTransport.initialize_(listenWindow)
Initializes this transport. Registers a method for 'message'-events in the global scope.
Arguments:
listenWindow : !Window
The window to listen to events on.
code »
goog.net.xpc.DirectTransport.isSupported(peerWindow) boolean
No description.
Arguments:
peerWindow : !Window
The peer window to check if DirectTranport is supported on.
Returns: boolean  Whether this transport is supported.
code »
goog.net.xpc.DirectTransport.messageReceivedHandler_(literal) boolean
No description.
Arguments:
literal : !Object
The literal unrenamed message.
Returns: boolean  Whether the message was successfully delivered to a channel.
code »
goog.net.xpc.DirectTransport.parseTransportPayload_(payload) !Array.<?string>
Parses a transport service payload message.
Arguments:
payload : string
The payload.
Returns: !Array.<?string>  An array with the message type as the first member and the endpoint id as the second, if one was sent, or null otherwise.
code »

Static Properties

goog.net.xpc.DirectTransport.CONNECTION_ATTEMPT_INTERVAL_MS_ :
No description.
Code »
goog.net.xpc.DirectTransport.CONNECTION_DELAY_INTERVAL_MS_ :
The delay to notify the xpc of a successful connection. This is used to allow both parties to be connected if one party's connection callback invokes an immediate send.
Code »
goog.net.xpc.DirectTransport.GLOBAL_TRANPORT_PATH_ :
Path of global message proxy.
Code »
goog.net.xpc.DirectTransport.MESSAGE_DELIMITER_ :
The delimiter used for transport service messages.
Code »
goog.net.xpc.DirectTransport.activeCount_ :
Tracks the number of DirectTransport channels that have been initialized but not disposed yet in a map keyed by the UID of the window object. This allows for multiple windows to be initiallized and listening for messages.
Code »
goog.net.xpc.DirectTransport.superClass_ :
No description.
Code »

Package net.xpc

Package Reference