SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
WebSocketFactory is used to create instances of WebSocket by specifying the end-point and the enabled protocols.
Using WebSocketFactory instance, application developers can set the ChallengeHandler
or enabled extensions that will be inherited by all the WebSocket instances created
from the factory. Once the WebSocket is connected, extensions that were successfully
negotiated with the server can be determined using WebSocket.extensions
property.
Constructor Summary | |
WebSocketFactory()
Creates a new WebSocketFactory instance. |
Method Summary | |
WebSocket
|
createWebSocket(location, protocols)
Creates a WebSocket to establish a full-duplex connection to the target location. |
ChallengeHandler
|
getChallengeHandler()
Gets the default ChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals. |
int
|
getDefaultConnectTimeout()
Gets the default connect timeout in milliseconds. |
HttpRedirectPolicy
|
getDefaultRedirectPolicy()
Gets the default HTTP redirect policy used in a clustered environment. |
WebSocketExtension
|
getExtension(name)
Gets the specified extension from the list of registered extensions. |
void
|
setChallengeHandler(challengeHandler)
Sets the default ChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals. |
void
|
setDefaultConnectTimeout(connectTimeout)
Sets the default connect timeout in milliseconds. |
void
|
setDefaultRedirectPolicy(redirectPolicy)
Sets the default HTTP redirect policy used in a clustered environment. |
void
|
setExtension(extension)
Registers the specified extension. |
Constructor Detail |
WebSocketFactory()
Method Detail |
WebSocket createWebSocket(location, protocols)
The extensions that were registered with the WebSocketFactory instance prior to this call are inherited by the newly created WebSocket instance.
If the port is blocked by the browser or if a secure connection is
attempted from a non-secure origin, this function will throw a
SecurityException
.
If any protocol value is invalid or if a protocol appears in the Array
more than once, this function will throw a SyntaxError
.
location
- {string} URL of the WebSocket service for the connection
protocols
- {string[]} protocols for the connection
WebSocket
the WebSocket
ChallengeHandler getChallengeHandler()
ChallengeHandler
the default ChallengeHandler
int getDefaultConnectTimeout()
int
default connect timeout
HttpRedirectPolicy getDefaultRedirectPolicy()
HttpRedirectPolicy
default HTTP redirect policy
WebSocketExtension getExtension(name)
name
- {String} extension name
WebSocketExtension
the registered extension with the specified name
void setChallengeHandler(challengeHandler)
challengeHandler
- {ChallengeHandler} the default ChallengeHandler
void
void setDefaultConnectTimeout(connectTimeout)
connectTimeout
- {int} default connection timeout
void
void setDefaultRedirectPolicy(redirectPolicy)
redirectPolicy
- {HttpRedirectPolicy} default HTTP redirect policy
void
void setExtension(extension)
WebSocket.extensions
property after the connection has
been established.
extension
- {WebSocketExtension} extension to be inherited by all the WebSockets
created using this factory
void