The goog.net.BrowserChannel.Handler Class

goog.net.BrowserChannel.Handler()

Interface for the browser channel handler

.badMapError(browserChannel, map)

Called by the channel if enumeration of the map throws an exception.

browserChannel {goog.net.BrowserChannel}
The browser channel.
map {Object}
The map that can't be enumerated.

.channelClosed(browserChannel, opt_pendingMaps, opt_undeliveredMaps)

Indicates the BrowserChannel is closed. Also notifies about which maps, if any, that may not have been delivered to the server.

browserChannel {goog.net.BrowserChannel}
The browser channel.
opt_pendingMaps {Array.<goog.net.BrowserChannel.QueuedMap>=}
The array of pending maps, which may or may not have been delivered to the server.
opt_undeliveredMaps {Array.<goog.net.BrowserChannel.QueuedMap>=}
The array of undelivered maps, which have definitely not been delivered to the server.

.channelError(browserChannel, error)

Indicates an error occurred on the BrowserChannel.

browserChannel {goog.net.BrowserChannel}
The browser channel.
error {goog.net.BrowserChannel.Error}
The error code.

.channelHandleArray(browserChannel, array)

New input is available for the application to process.

browserChannel {goog.net.BrowserChannel}
The browser channel.
array {Array}
The data array.

.channelHandleMultipleArrays {Function}

Callback handler for when a batch of response arrays is received from the server.

.channelOpened(browserChannel)

Indicates the BrowserChannel has successfully negotiated with the server and can now send and receive data.

browserChannel {goog.net.BrowserChannel}
The browser channel.

.channelSuccess(browserChannel, deliveredMaps)

Indicates maps were successfully sent on the BrowserChannel.

browserChannel {goog.net.BrowserChannel}
The browser channel.
deliveredMaps {Array.<goog.net.BrowserChannel.QueuedMap>}
The array of maps that have been delivered to the server. This is a direct reference to the internal BrowserChannel array, so a copy should be made if the caller desires a reference to the data.

.correctHostPrefix(serverHostPrefix)

Allows the handler to override a host prefix provided by the server. Will be called whenever the channel has received such a prefix and is considering its use.

serverHostPrefix {?string}
The host prefix provided by the server.
returns {?string}
The host prefix the client should use.

.getAdditionalParams(browserChannel)

Gets any parameters that should be added at the time another connection is made to the server.

browserChannel {goog.net.BrowserChannel}
The browser channel.
returns {Object}
Extra parameter keys and values to add to the requests.

.getNetworkTestImageUri(browserChannel)

Gets the URI of an image that can be used to test network connectivity.

browserChannel {goog.net.BrowserChannel}
The browser channel.
returns {goog.Uri?}
A custom URI to load for the network test.

.isActive(browserChannel)

Gets whether this channel is currently active. This is used to determine the length of time to wait before retrying.

browserChannel {goog.net.BrowserChannel}
The browser channel.
returns {boolean}
Whether the channel is currently active.

.okToMakeRequest(browserChannel)

Whether it's okay to make a request to the server. A handler can return false if the channel should fail. For example, if the user has logged out, the handler may want all requests to fail immediately.

browserChannel {goog.net.BrowserChannel}
The browser channel.
returns {goog.net.BrowserChannel.Error}
An error code. The code should return goog.net.BrowserChannel.Error.OK to indicate it's okay. Any other error code will cause a failure.