Packagecom.kaazing.gateway.client.html5
Classpublic class WebSocket
InheritanceWebSocket Inheritance flash.events.EventDispatcher

WebSocket provides a text-based socket abstraction for ActionScript.



Public Properties
 PropertyDefined by
  bufferedAmount : int
[read-only] The number of bytes queued to be sent.
WebSocket
  onclose : Function
The onclose handler is called when the connection is terminated.
WebSocket
  onmessage : Function
The omessage handler is called when data arrives.
WebSocket
  onopen : Function
The onopen handler is called when the connection is established.
WebSocket
  protocol : String
[read-only] The subprotocol selected by the server, if any.
WebSocket
  readyState : Number
[read-only] The ready state indicates the connection status.
WebSocket
  URL : String
[read-only] The URL with which the WebSocket was constructed.
WebSocket
Public Methods
 MethodDefined by
  
WebSocket(location:String, protocol:String = null)
WebSocket
  
close(code:int = 0, reason:String = ""):void
Disconnects the remote socket location.
WebSocket
  
handleClose(event:CloseEvent):void
WebSocket
  
handleError(event:Event):void
WebSocket
  
WebSocket
  
handleOpen(event:Event):void
WebSocket
  
send(data:*):void
Sends text-based data to the remote socket location.
WebSocket
Events
 EventSummaryDefined by
   Dispatched when the connection is terminated.WebSocket
   Dispatched when data arrives.WebSocket
   Dispatched when the connection is established.WebSocket
Property detail
bufferedAmountproperty
bufferedAmount:int  [read-only]

The number of bytes queued to be sent.

Implementation
    public function get bufferedAmount():int
oncloseproperty 
public var onclose:Function

The onclose handler is called when the connection is terminated.

onmessageproperty 
public var onmessage:Function

The omessage handler is called when data arrives.

onopenproperty 
public var onopen:Function

The onopen handler is called when the connection is established.

protocolproperty 
protocol:String  [read-only]

The subprotocol selected by the server, if any.

Implementation
    public function get protocol():String
readyStateproperty 
readyState:Number  [read-only]

The ready state indicates the connection status.

Implementation
    public function get readyState():Number
URLproperty 
URL:String  [read-only]

The URL with which the WebSocket was constructed.

Implementation
    public function get URL():String
Constructor detail
WebSocket()constructor
public function WebSocket(location:String, protocol:String = null)Parameters
location:String
 
protocol:String (default = null)
Method detail
close()method
public function close(code:int = 0, reason:String = ""):void

Disconnects the remote socket location.

Parameters
code:int (default = 0)
 
reason:String (default = "")
handleClose()method 
public function handleClose(event:CloseEvent):voidParameters
event:CloseEvent
handleError()method 
public function handleError(event:Event):voidParameters
event:Event
handleMessage()method 
public function handleMessage(event:MessageEvent):voidParameters
event:MessageEvent
handleOpen()method 
public function handleOpen(event:Event):voidParameters
event:Event
send()method 
public function send(data:*):void

Sends text-based data to the remote socket location.

Parameters
data:* — data the data payload
Event detail
closeevent 
Event object type: CloseEvent

Dispatched when the connection is terminated.

messageevent  
Event object type: MessageEvent

Dispatched when data arrives.

openevent  
Event object type: flash.events.Event

Dispatched when the connection is established.