messaging.RespondingChannel Extends goog.Disposable
Creates a new RespondingChannel wrapping a single MessageChannel.

Inheritance

Constructor

goog.messaging.RespondingChannel(messageChannel)

Parameters

messageChannel : goog.messaging.MessageChannel
The messageChannel to to wrap and allow for responses. This channel must not have any existing services registered. All service registration must be done through the RespondingChannel#registerService api instead. The other end of channel must also be a RespondingChannel.

Instance Methods

Public Protected Private
callbackProxy_(callbackmessage)
A intermediary proxy for service callbacks to be invoked and return their their results to the remote caller's callback.
Arguments:
callback : function((string | !Object))
The callback to process the incoming messages. Passed the payload.
message : !Object | string
The message containing the signature and the data to invoke the service callback with.
code »
callbackServiceHandler_(message)
Receives the results of the peer's service results.
Arguments:
message : !Object | string
The results from the remote service invocation.
code »
disposeInternal()
No description.
code »
getNextSignature_() number
Gets a random number to use for method invocation results.
Returns: number  A unique random signature.
code »
registerService(serviceNamecallback)
Registers a service to be called when a message is received.
Arguments:
serviceName : string
The name of the service.
callback : function(!Object)
The callback to process the incoming messages. Passed the payload.
code »
send(serviceNamepayloadcallback)
Sends a message over the channel.
Arguments:
serviceName : string
The name of the service this message should be delivered to.
payload : string | !Object
The value of the message. If this is an Object, it is serialized to a string before sending if necessary.
callback : function(?Object)
The callback invoked with the result of the service call.
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

constructor :
No description.
Code »
logger_ : goog.debug.Logger
Logger object for goog.messaging.RespondingChannel.
Code »
messageChannel_ : goog.messaging.MultiChannel
The message channel wrapped in a MultiChannel so we can send private and public messages on it.
Code »
nextSignatureIndex_ :
The next signature index to save the callback against.
Code »
The virtual channel to send private messages on.
Code »
The virtual channel to send public messages on.
Code »
sigCallbackMap_ :
Map of invocation signatures to function callbacks. These are used to keep track of the asyncronous service invocations so the result of a service call can be passed back to a callback in the calling frame.
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 Properties

goog.messaging.RespondingChannel.CALLBACK_SERVICE_ :
The name of the method invocation callback service (used internally).
Code »
goog.messaging.RespondingChannel.PRIVATE_CHANNEL_ :
The name of the channel to send private control messages on.
Code »
goog.messaging.RespondingChannel.PUBLIC_CHANNEL_ :
The name of the channel to send public messages on.
Code »
goog.messaging.RespondingChannel.superClass_ :
No description.
Code »

Package messaging

Package Reference