Conforms to NSObject
Declared in KGWebSocketDelegate.h

Overview

The KGWebSocketDelegate protocol defines methods implemented by delegates of KGWebSocket objects.

Tasks

Instance Methods

webSocket:didCloseWithCode:reason:wasClean:

Sent to the delegate when WebSocket connection’s readyState changes to CLOSED.

- (void)webSocket:(KGWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean

Parameters

webSocket

The KGWebSocket instance sending the message.

code

The WebSocket connection close code provided by the server.

reason

A string indicating the reason the server closed the connection.

wasClean

Indicates whether or not the connection was cleanly closed.

Declared In

KGWebSocketDelegate.h

webSocket:didReceiveError:

Sent to the delegate when error occurs.

- (void)webSocket:(KGWebSocket *)webSocket didReceiveError:(NSError *)error

Parameters

webSocket

The KGWebSocket instance sending the message.

error

The error.

Declared In

KGWebSocketDelegate.h

webSocket:didReceiveMessage:

Sent to the delegate when message is received from the server.

- (void)webSocket:(KGWebSocket *)webSocket didReceiveMessage:(id)data

Parameters

webSocket

The KGWebSocket instance sending the message.

data

The data from the server. It can be either NSString or NSData.

Declared In

KGWebSocketDelegate.h

webSocketDidOpen:

Sent to the delegate when WebSocket connection’s readyState changes to OPEN. This indicates that the connection is ready to send and receive data.

- (void)webSocketDidOpen:(KGWebSocket *)webSocket

Parameters

webSocket

The KGWebSocket instance sending the message.

Declared In

KGWebSocketDelegate.h