The goog.messaging.BufferedChannel Class

goog.messaging.BufferedChannel
> goog.Disposable

goog.messaging.BufferedChannel(messageChannel, opt_interval)

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.

messageChannel {!goog.messaging.MessageChannel}
The MessageChannel we're wrapping.
opt_interval {number=}
Polling interval for sending ready notifications to peer, in ms. Default is 50.

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.connect()

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.isConnected()

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.isPeerReady()

returns {boolean}
Whether the channel's peer is ready.

.registerDefaultService()

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.registerService()

.send(serviceName, 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.

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 JSON before sending. It's the responsibility of implementors of this class to perform the serialization.
@see
goog.net.xpc.BufferedChannel.send