Home

# Class goog.messaging.AbstractChannel

Creates an abstract message channel.

extends goog.Disposable

Instance Method Summary
| `decodePayload(string serviceName, (Object|string) payload, boolean objectPayload) ⇒ (Object|null|string)` Converts the message payload into the format expected by the registered service (either JSON or string).

`deliver(string serviceName, (Object|string) payload)`

Delivers a message to the appropriate service. This is meant to be called by subclasses when they receive messages. This method takes into account both explicitly-registered and default services, as well as making sure that JSON payloads are decoded when necessary. If the subclass is capable of passing objects as payloads, those objects can be passed in to this method directly. Otherwise, the (potentially JSON-encoded) strings should be passed in.

`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.
    ...
    };

| `getService(string serviceName, (Object|string) payload) ⇒ ?{callback: function ((Object|string)): ?, objectPayload: boolean}` Find the service object for a given service name. If there's no service explicitly registered, but there is a default service, a service object is constructed for it.