goog.net.BrowserChannel |
opt_clientVersion
: string=
An application-specific version number
that is sent to the server when connected.
|
opt_firstTestResults
: Array.<string>>
Previously determined results
of the first browser channel test.
|
opt_secondTestResults
: boolean=
Previously determined results
of the second browser channel test.
|
![]()
Adds the additional parameters from the handler to the given URI.
Arguments:
|
code » | ||||||
![]()
Cancels all outstanding requests.
|
code » | ||||||
![]()
Clears the timer that indicates that our backchannel is no longer able to
successfully receive data from the server.
|
code » | ||||||
![]()
Starts the channel. This initiates connections to the server.
Arguments:
|
code » | ||||||
![]()
Starts the regular channel which is run after the test channel is complete.
|
code » | ||||||
![]()
Starts the test channel to determine network conditions.
Arguments:
|
code » | ||||||
Decides which host prefix should be used, if any. If there is a handler,
allows the handler to validate a host prefix provided by the server, and
optionally override it.
|
code » | ||||||
Creates a data Uri applying logic for secondary hostprefix, port
overrides, and versioning.
|
code » | ||||||
Called when BC needs to create an XhrIo object. Override in a subclass if
you need to customize the behavior, for example to enable the creation of
XHR's capable of calling a secondary domain. Will also allow calling
a secondary domain if withCredentials (CORS) is enabled.
Arguments:
Returns: !goog.net.XhrIo
A new XhrIo object.
|
code » | ||||||
Returns the request text from the outgoing maps and resets it.
Returns: string
The encoded request text created from all the currently
queued outgoing maps.
|
code » | ||||||
![]()
Disconnects and closes the channel.
|
code » | ||||||
![]()
Ensures there is a backchannel request for receiving data from the server.
|
code » | ||||||
![]()
Ensures that a forward channel request is scheduled.
|
code » | ||||||
![]()
Helper to ensure the BrowserChannel is in the expected state.
Arguments:
|
code » | ||||||
![]()
Returns whether chunked mode is allowed. In certain debugging situations,
it's useful for the application to have a way to disable chunked mode for a
user.
@return {boolean} Whether chunked mode is allowed.
|
code » | ||||||
Returns whether the channel allows the use of a subdomain. There may be
cases where this isn't allowed.
Returns: boolean
Whether a host prefix is allowed.
|
code » | ||||||
No description.
Returns: number
The max number of back-channel retries, which is a constant.
|
code » | ||||||
Gets the Uri used for the connection that receives data from the server.
|
code » | ||||||
Returns the browserchannel logger.
Returns: !goog.net.ChannelDebug
The channel debug object.
|
code » | ||||||
Returns the extra HTTP headers to add to all the requests sent to the server.
Returns: Object
The HTTP headers, or null.
|
code » | ||||||
Gets the results for the first browser channel test
|
code » | ||||||
No description.
Returns: number
The max number of forward-channel retries, which will be 0
in fail-fast mode.
|
code » | ||||||
Gets the Uri used for the connection that sends data to the server.
|
code » | ||||||
Returns the handler used for channel callback events.
Returns: goog.net.BrowserChannel.Handler
The handler.
|
code » | ||||||
No description.
Returns: number
The last array id received.
|
code » | ||||||
Return the last status code received for a request.
Returns: number
The last status code received for a request.
|
code » | ||||||
No description.
|
code » | ||||||
Gets the results for the second browser channel test
Returns: ?boolean
The results. True -> buffered connection,
False -> unbuffered, null -> unknown.
|
code » | ||||||
Returns the session id of the channel. Only available after the
channel has been opened.
Returns: string
Session ID.
|
code » | ||||||
![]()
Returns the browser channel state.
Returns: goog.net.BrowserChannel.State
The current state of the browser
channel.
|
code » | ||||||
![]()
Handles a POST response from the server telling us that it has detected that
we have no hanging GET connection.
|
code » | ||||||
![]()
Handles a POST response from the server.
Arguments:
|
code » | ||||||
Returns whether there are outstanding requests servicing the channel.
Returns: boolean
true if there are outstanding requests.
|
code » | ||||||
Gets whether this channel is currently active. This is used to determine the
length of time to wait before retrying. This call delegates to the handler.
Returns: boolean
Whether the channel is currently active.
|
code » | ||||||
Returns whether the channel is buffered or not. This state is valid for
querying only after the test connection has completed. This may be
queried in the goog.net.BrowserChannel.okToMakeRequest() callback.
A channel may be buffered if the test connection determines that
a chunked response could not be sent down within a suitable time.
Returns: boolean
Whether the channel is buffered.
|
code » | ||||||
Returns whether the channel is closed
Returns: boolean
true if the channel is closed.
|
code » | ||||||
![]()
Makes a forward channel request using XMLHTTP.
Arguments:
|
code » | ||||||
Schedules a back-channel retry, unless the max retries has been reached.
Returns: boolean
true iff a retry was scheduled.
|
code » | ||||||
Schedules a forward-channel retry for the specified request, unless the max
retries has been reached.
Arguments:
Returns: boolean
true iff a retry was scheduled.
|
code » | ||||||
![]()
Notify the channel that a particular fine grained network event has occurred.
Should be considered package-private.
Arguments:
|
code » | ||||||
Gives the handler a chance to return an error code and stop channel
execution. A handler might want to do this to check that the user is still
logged in, for example.
Returns: boolean
If it's OK to make a request.
|
code » | ||||||
![]()
Handles the timer that indicates that our backchannel is no longer able to
successfully receive data from the server.
|
code » | ||||||
![]()
Called when the channel has been closed. It notifiers the handler of the
event, and reports any pending or undelivered maps.
|
code » | ||||||
![]()
Called when we've determined the final error for a channel. It closes the
notifiers the handler of the error and closes the channel.
Arguments:
|
code » | ||||||
![]()
Processes the data returned by the server.
|
code » | ||||||
![]()
Callback from ChannelRequest that indicates a request has completed.
Arguments:
|
code » | ||||||
![]()
Callback from ChannelRequest for when new data is received
Arguments:
|
code » | ||||||
![]()
Timer callback for ensureBackChannel_.
|
code » | ||||||
![]()
Timer callback for ensureForwardChannel
Arguments:
|
code » | ||||||
![]()
Called when messages have been successfully sent from the queue.
|
code » | ||||||
![]()
Establishes a new channel session with the the server.
|
code » | ||||||
Returns the number of outstanding requests.
Returns: number
The number of outstanding requests to the server.
|
code » | ||||||
![]()
Requeues unacknowledged sent arrays for retransmission in the next forward
channel request.
|
code » | ||||||
![]()
Sends a request to the server. The format of the request is a Map data
structure of key/value pairs. These maps are then encoded in a format
suitable for the wire and then reconstituted as a Map data structure that
the server can process.
Arguments:
|
code » | ||||||
![]()
Sets whether chunked mode is allowed. In certain debugging situations, it's
useful for the application to have a way to disable chunked mode for a user.
Arguments:
|
code » | ||||||
![]()
Sets whether the channel allows the use of a subdomain. There may be cases
where this isn't allowed, for example, logging in with troutboard where
using a subdomain causes Apache to force the user to authenticate twice.
Arguments:
|
code » | ||||||
![]()
Set the browserchannel logger.
TODO(user): Add interface for channel loggers or remove this function.
Arguments:
|
code » | ||||||
![]()
Sets extra HTTP headers to add to all the requests sent to the server.
Arguments:
|
code » | ||||||
![]()
When set to true, this changes the behavior of the forward channel so it
will not retry requests; it will fail after one network failure, and if
there was already one network failure, the request will fail immediately.
Arguments:
|
code » | ||||||
![]()
Sets the maximum number of attempts to connect to the server for forward
channel requests.
Arguments:
|
code » | ||||||
![]()
Sets the timeout for a forward channel request.
Arguments:
|
code » | ||||||
![]()
Sets the handler used for channel callback events.
Arguments:
|
code » | ||||||
![]()
Sets a new parser for the response payload. A custom parser may be set to
avoid using eval(), for example. By default, the parser uses
goog.json.unsafeParse .
Arguments:
|
code » | ||||||
![]()
Sets the throttle for handling onreadystatechange events for the request.
Arguments:
|
code » | ||||||
![]()
No description.
|
code » | ||||||
![]()
Sets whether cross origin requests are supported for the browser channel.
Setting this allows the creation of requests to secondary domains and
sends XHRs with the CORS withCredentials bit set to true.
In order for cross-origin requests to work, the server will also need to set
CORS response headers as per:
https://developer.mozilla.org/en-US/docs/HTTP_access_control
See
goog.net.XhrIo#setWithCredentials .
Arguments:
|
code » | ||||||
Determines whether we should start the process of retrying a possibly
dead backchannel.
|
code » | ||||||
Determines whether to use a secondary domain when the server gives us
a host prefix. This allows us to work around browser per-domain
connection limits.
Currently, we use secondary domains when using Trident's ActiveXObject,
because it supports cross-domain requests out of the box. Note that in IE10
we no longer use ActiveX since it's not supported in Metro mode and IE10
supports XHR streaming.
If you need to use secondary domains on other browsers and IE10,
you have two choices:
1) If you only care about browsers that support CORS
(https://developer.mozilla.org/en-US/docs/HTTP_access_control), you
can use
#setSupportsCrossDomainXhrs and set the appropriate
CORS response headers on the server.
2) Or, override this method in a subclass, and make sure that those
browsers use some messaging mechanism that works cross-domain (e.g
iframes and window.postMessage).
Returns: boolean
Whether to use secondary domains.
|
code » | ||||||
![]()
Signals an error has occurred.
Arguments:
|
code » | ||||||
![]()
Begins a new back channel operation to the server.
|
code » | ||||||
![]()
Begins a new forward channel operation to the server.
Arguments:
|
code » | ||||||
![]()
Callback from BrowserTestChannel for when the channel is blocked.
Arguments:
|
code » | ||||||
![]()
Callback from BrowserTestChannel for when the channel has an error.
Arguments:
|
code » | ||||||
![]()
Callback from BrowserTestChannel for when the channel is finished.
Arguments:
|
code » | ||||||
![]()
Callback for testGoogleCom during error handling.
Arguments:
|
code » |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
The attempt id for the current back channel request. Starts at 1 and
increments for each reconnect. The server uses this to log if our connection
is flaky or not.
|
Code » | |
The ChannelRequest object for the backchannel.
|
Code » | |
![]()
Number of times it a row that we have retried the current back channel
request and received no data.
|
Code » | |
![]()
Timer identifier for asynchronously making a back channel request.
|
Code » | |
The absolute URI for the backchannel request.
|
Code » | |
![]()
The base part of the time before firing next retry request. Default is 5
seconds. Note that a random delay is added (see
retryDelaySeedMs_ )
for all retries, and linear backoff is applied to the sum for subsequent
retries.
|
Code » | |
The channel debug used for browserchannel logging
|
Code » | |
![]()
The channel version that we negotiated with the server for this session.
Starts out as the version we request, and then is changed to the negotiated
version after the initial open.
|
Code » | |
![]()
The application specific version that is passed to the server.
|
Code » | |
The BrowserTestChannel object which encapsulates the logic for determining
interesting network conditions about the client.
|
Code » | |
![]()
Timer identifier for the timer that waits for us to retry the backchannel in
the case where it is dead and no longer receiving data.
|
Code » | |
![]()
Extra HTTP headers to add to all the requests sent to the server.
|
Code » | |
![]()
Extra parameters to add to all the requests sent to the server.
|
Code » | |
![]()
Whether to fail forward-channel requests after one try, or after a few tries.
|
Code » | |
![]()
An array of results for the first browser channel test call.
|
Code » | |
![]()
Maximum number of attempts to connect to the server for forward channel
requests. Defaults to 2.
|
Code » | |
![]()
The timeout in milliseconds for a forward channel request. Defaults to 20
seconds. Note that part of this timeout can be randomized.
|
Code » | |
The current ChannelRequest object for the forwardchannel.
|
Code » | |
![]()
Number of times we have retried the current forward channel request.
|
Code » | |
![]()
Timer identifier for asynchronously making a forward channel request.
|
Code » | |
The absolute URI for the forwardchannel request.
|
Code » | |
The handler that receive callbacks for state changes and data.
|
Code » | |
![]()
A subdomain prefix for using a subdomain in IE for the backchannel
requests.
|
Code » | |
![]()
The array identifier of the last array received from the server for the
backchannel request.
|
Code » | |
![]()
The array identifier of the last array sent by the server that we know about.
|
Code » | |
![]()
The last status code received.
|
Code » | |
![]()
The id to use for the next outgoing map. This identifier uniquely
identifies a sent map.
|
Code » | |
![]()
The next id to use for the RID (request identifier) parameter. This
identifier uniquely identifies the forward channel request.
|
Code » | |
![]()
An array of queued maps that need to be sent to the server.
|
Code » | |
Parser for a response payload. Defaults to use
goog.json.unsafeParse . The parser should return an array.
|
Code » | |
![]()
The relative path (in the context of the the page hosting the browser
channel) for making requests to the server.
|
Code » | |
![]()
An array of dequeued maps that we have either received a non-successful
response for, or no response at all, and which therefore may or may not
have been received by the server.
|
Code » | |
![]()
A throttle time in ms for readystatechange events for the backchannel.
Useful for throttling when ready state is INTERACTIVE (partial data).
This throttle is useful if the server sends large data chunks down the
backchannel. It prevents examining XHR partial data on every
readystate change event. This is useful because large chunks can
trigger hundreds of readystatechange events, each of which takes ~5ms
or so to handle, in turn making the UI unresponsive for a significant period.
If set to zero no throttle is used.
|
Code » | |
![]()
A random time between 0 and this number of MS is added to the
baseRetryDelayMs_ . Default is 10 seconds.
|
Code » | |
![]()
The results of the second browser channel test. True implies the
connection is buffered, False means unbuffered, null means that
the results are not available.
|
Code » | |
![]()
The current state of the BrowserChannel. It should be one of the
goog.net.BrowserChannel.State constants.
|
Code » | |
![]()
Whether cross origin requests are supported for the browser channel.
See
goog.net.XhrIo#setWithCredentials .
|
Code » | |
![]()
Whether the client's network conditions can support chunked responses.
|
Code » |
![]()
Instantiates a ChannelRequest with the given parameters. Overidden in tests.
Arguments:
Returns: !goog.net.ChannelRequest
The created channel request.
|
code » | ||||||
Returns the singleton event target for stat events.
Returns: goog.events.EventTarget
The event target for stat events.
|
code » | ||||||
Returns whether or not the given error/status combination is fatal or not.
On fatal errors we immediately close the session rather than retrying the
failed request.
|
code » | ||||||
![]()
Helper function to call the stat event callback.
Arguments:
|
code » | ||||||
![]()
Helper function to notify listeners about POST request performance.
|
code » | ||||||
![]()
Helper function to call the end hook
|
code » | ||||||
![]()
Helper function to call the start hook
|
code » | ||||||
![]()
Allows the application to set an execution hooks for when BrowserChannel
stops processing requests. This is useful to track timing or logging
special information. The function takes no parameters and return void.
Arguments:
|
code » | ||||||
![]()
Allows the application to set an execution hooks for when BrowserChannel
starts processing requests. This is useful to track timing or logging
special information. The function takes no parameters and return void.
Arguments:
|
code » | ||||||
Wrapper around SafeTimeout which calls the start and end execution hooks
with a try...finally block.
|
code » |
![]()
Maximum number of attempts to connect to the server for back channel
requests.
|
Code » | |
![]()
Events fired by BrowserChannel and associated objects
|
Code » | |
![]()
The timeout in milliseconds for a forward channel request.
|
Code » | |
![]()
When retrying for an inactive channel, we will multiply the total delay by
this number.
|
Code » | |
![]()
The latest protocol version that this class supports. We request this version
from the server when opening the connection. Should match
com.google.net.browserchannel.BrowserChannel.LATEST_CHANNEL_VERSION.
|
Code » | |
![]()
A LogSaver that can be used to accumulate all the debug logs for
BrowserChannels so they can be sent to the server when a problem is
detected.
|
Code » | |
![]()
The normal response for forward channel requests.
Used only before version 8 of the protocol.
|
Code » | |
![]()
The maximum number of maps that can be sent in one POST. Should match
com.google.net.browserchannel.BrowserChannel.MAX_MAPS_PER_REQUEST.
|
Code » | |
![]()
A guess at a cutoff at which to no longer assume the backchannel is dead
when we are slow to receive data. Number in bytes.
Assumption: The worst bandwidth we work on is 50 kilobits/sec
50kbits/sec * (1 byte / 8 bits) * 6 sec dead backchannel timeout
|
Code » | |
![]()
A number in MS of how long we guess the maxmium amount of time a round trip
to the server should take. In the future this could be substituted with a
real measurement of the RTT.
|
Code » | |
![]()
Application provided execution hook for the end hook.
|
Code » | |
![]()
Application provided execution hook for the start hook.
|
Code » | |
Singleton event target for firing stat events
|
Code » |
![]()
Internal enum type for the two browser channel channel types.
Constants:
|
Code » | ||||||||||||||||||||||||
![]()
Enum type for identifying a BrowserChannel error.
Constants:
|
Code » | ||||||||||||||||||||||||
![]()
Types of events which reveal information about the reachability of the
server.
Constants:
|
Code » | ||||||||||||||||||||||||
![]()
Enum that identifies events for statistics that are interesting to track.
TODO(user) - Change name not to use Event or use EventTarget
Constants:
|
Code » | ||||||||||||||||||||||||
![]()
Enum type for the browser channel state machine.
Constants:
|
Code » |