Class WebSocket

WebSocket provides a bidirectional communication channel. Application developers should use WebSocketFactory#createWebSocket() function to create an instance of WebSocket.


Field Summary
String binaryType
          Type of binary data for message events.
Number bufferedAmount
          (Read only) Number of bytes that are queued to send but not yet written to the network.
Number(Integer) connectTimeout
          (Read only) Connect timeout in milliseconds.
String extensions
          Extensions chosen by the server during the connection handshake.
Function onclose
          CloseEvent handler property.
Function onerror
          ErrorEvent handler property.
Function onmessage
          MessageEvent handler property.
Function onopen
          Event fired when the WebSocket connection opens.
String protocol
          Protocol name selected by the WebSocket server during the connection handshake.
Number readyState
          (Read only) State of the connection.
String url
          (Read only) The location of the WebSocket.
 
Constructor Summary
WebSocket(url, protocols)
            Creates and immedately connects a new WebSocket instance.
 
Method Summary
 void void close(code, reason)
           Disconnects the WebSocket.
 ChallengeHandler getChallengeHandler()
           Gets the ChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals.
 HttpRedirectPolicy getRedirectPolicy()
           Gets the default HTTP redirect policy used in a clustered environment for this connection.
 void send(data)
           Sends a WebSocket message containing the given payload.
 void setChallengeHandler(challengeHandler)
           Sets the ChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals.
 void setRedirectPolicy(redirectPolicy)
           Sets the HTTP redirect policy used in a clustered environment for this connection.
 
Event Summary
void close()
           Event fired when the WebSocket connection closes.
void error()
           Event fired when the WebSocket closes uncleanly.
void message()
           Event fired when a WebSocket message arrives.
void open()
           Event fired when the WebSocket connection opens.
 
Field Detail

binaryType

String binaryType

bufferedAmount

Number bufferedAmount

connectTimeout

Number(Integer) connectTimeout

extensions

String extensions

onclose

Function onclose

onerror

Function onerror

onmessage

Function onmessage

onopen

Function onopen

protocol

String protocol

readyState

Number readyState

url

String url

Constructor Detail

WebSocket

WebSocket(url, protocols)

Method Detail

close

void void close(code, reason)

getChallengeHandler

ChallengeHandler getChallengeHandler()

getRedirectPolicy

HttpRedirectPolicy getRedirectPolicy()

send

void send(data)

setChallengeHandler

void setChallengeHandler(challengeHandler)

setRedirectPolicy

void setRedirectPolicy(redirectPolicy)

Event Detail

close

close()

error

error()

message

message()

open

open()