Mixin: SC.WebSocketDelegate

A WebSocket Delegate is consulted by SC.WebSocket when events are received. You may want to handle this events before propagate them to eventual listeners.

Example:

var ws = SC.WebSocket.create({ server: 'ws://server', delegate: MyApp.WebSocketDelegate });

Defined in: websocket_delegate.js

Since:
SproutCore 1.11

Field Summary

Class Methods

Field Detail

SC.WebSocketDelegate.isWebSocketDelegate Boolean
Walk like a duck

Class Method Detail

webSocketDidClose(webSocket, closeEvent)

The websocket connection is close. Return true to prevent a reconnection or further handling.

Parameters:
webSocket
{SC.WebSocket} The webSocket object
closeEvent
{CloseEvent} The closeEvent
Returns:
Boolean
Return true to prevent further handling
webSocketDidError(webSocket, event)
Call when an error occur.
Parameters:
webSocket
{SC.WebSocket} The webSocket object
event
{Event}
Returns:
Boolean
Return true to prevent further handling
webSocketDidOpen(webSocket, event)
The passed webSocket connection is open.
Parameters:
webSocket
{SC.WebSocket} The webSocket object
event
{Event}
webSocketDidReceiveMessage(webSocket, data)

A message has been received. Before processing it, you have a chance to check it.

For example, if isJSON is true, you will want to check if the message is a correct JSON.

Parameters:
webSocket
{SC.WebSocket} The webSocket object
data
{String}
Returns:
String|Boolean
Return true to prevent further handling
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)