Home

# Class goog.messaging.BufferedChannel

Creates a new BufferedChannel, which operates like its underlying channel except that it buffers calls to send until it receives a message from its peer claiming that the peer is ready to receive. The peer is also expected to be a BufferedChannel, though this is not enforced.

extends goog.Disposable

Instance Method Summary

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

| `isPeerReady() ⇒ boolean`
| `onTick_(?goog.events.Event unusedEvent)` Handles one tick of our peer ready notification loop. This entails sending a ready ping to the peer and shutting down the loop if we've received a ping ourselves.
| `send(string serviceName, (Object|string) payload)` Send a message over the channel. If the peer is not ready, the message will be buffered and sent once we've received a ready message from our peer.
| `setPeerReady_()` Marks the channel's peer as ready, then sends buffered messages and nulls the buffer. Subsequent calls to setPeerReady_ have no effect.