Inherits from NSObject
Declared in KGWebSocketFactory.h

Overview

KGWebSocketFactory is used to create KGWebSocket instance(s) by specifying the end-point and the enabled protocols.

Using KGWebSocketFactory instance, application developers can set KGWebSocketParameter that will be inherited by all the KGWebSocket instances created from the factory. Application developers can override the parameter(s) at the individual KGWebSocket level too.

Tasks

  • + createWebSocketFactory

    Creates a KGWebSocket to establish a full-duplex connection to the target location.

  • – createWebSocket:

    Creates a KGWebSocket to establish a full-duplex connection to the target location.

  • – createWebSocket:protocols:

    Creates a KGWebSocket to establish a full-duplex connection to the target location.

  • – defaultParameter:

    Returns the default value of the specified KGWebSocketExtensionParameter

  • – setDefaultParameter:value:

    Sets the default value of the specified KGWebSocketExtensionParameter that will be inherited by all the KGWebSocket instances that are created using this factory instance. KGWebSocket created before setting the parameter using this API will not be able to inherit the default value of the parameter.

  • – defaultEnabledExtensions

    Gets the names of the default enabled extensions that will be inherited by all the KGWebSocket objectes created using this factory. These extensions are negotiated between the client and the server during the WebSocket handshake only if all the required parameters belonging to the extension have been set as enabled parameters. An empty Collection is returned if no extensions have been enabled for this factory.

  • – setDefaultEnabledExtensions:

    Registers the names of all the default enabled extensions to be inherited by all the KGWebSocket objects created using this factory. The extensions will be negotiated between the client and the server during the WebSocket handshake if all the required parameters belonging to the extension have been set.

  • – defaultChallengeHandler

    Gets the default KGChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals.

  • – setDefaultChallengeHandler:

    Sets the default KGChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals. All the KGWebSocket instances created using this factory will inherit the default ChallengeHandler.

  • – clientIdentity

    Returns the SecIdentityRef object used for client certificate authentication

  • – setClientIdentity:

    Sets Client Identity for SSL client certificate authentication. The Client Identity set in KGWebSocketFactory will be inherited by the KGWebSocket created from this factory.

  • – defaultConnectTimeout

    Gets the default connect timeout in milliseconds. Default value of the default connect timeout is zero — which means no timeout.

  • – setDefaultConnectTimeout:

    Sets the default connect timeout in milliseconds. The specified timeout is inherited by all the WebSocket instances that are created using this WebSocketFactory instance. The timeout will expire if there is no exchange of packets(for example, 100% packet loss) while establishing the connection. A timeout value of zero indicates no timeout.

Class Methods

createWebSocketFactory

Creates a KGWebSocket to establish a full-duplex connection to the target location.

+ (KGWebSocketFactory *)createWebSocketFactory

Discussion

The default extension parameters that were set on the KGWebSocketFactory prior to this call are inherited by the newly created KGWebSocket instance.

Declared In

KGWebSocketFactory.h

Instance Methods

clientIdentity

Returns the SecIdentityRef object used for client certificate authentication

- (SecIdentityRef)clientIdentity

Return Value

SecIdentityRef object

Declared In

KGWebSocketFactory.h

createWebSocket:

Creates a KGWebSocket to establish a full-duplex connection to the target location.

- (KGWebSocket *)createWebSocket:(NSURL *)url

Parameters

location

NSURL to server

Discussion

The default extension parameters that were set on the KGWebSocketFactory prior to this call are inherited by the newly newly created KGWebSocket instance.

Exceptions

NSException

If the scheme is invalid

Declared In

KGWebSocketFactory.h

createWebSocket:protocols:

Creates a KGWebSocket to establish a full-duplex connection to the target location.

- (KGWebSocket *)createWebSocket:(NSURL *)url protocols:(NSArray *)protocols

Parameters

protocols

protocols to be negotiated over the WebSocket

location

URI of the WebSocket service for the connection

Discussion

The default extension parameters that were set on the KGWebSocketFactory prior to this call are inherited by the newly newly created KGWebSocket instance.

Exceptions

NSException

If the scheme is invalid

Declared In

KGWebSocketFactory.h

defaultChallengeHandler

Gets the default KGChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals.

- (KGChallengeHandler *)defaultChallengeHandler

Declared In

KGWebSocketFactory.h

defaultConnectTimeout

Gets the default connect timeout in milliseconds. Default value of the default connect timeout is zero — which means no timeout.

- (int)defaultConnectTimeout

Return Value

default connect timeout value in milliseconds

Declared In

KGWebSocketFactory.h

defaultEnabledExtensions

Gets the names of the default enabled extensions that will be inherited by all the KGWebSocket objectes created using this factory. These extensions are negotiated between the client and the server during the WebSocket handshake only if all the required parameters belonging to the extension have been set as enabled parameters. An empty Collection is returned if no extensions have been enabled for this factory.

- (NSArray *)defaultEnabledExtensions

Declared In

KGWebSocketFactory.h

defaultParameter:

Returns the default value of the specified KGWebSocketExtensionParameter

- (id)defaultParameter:(KGWebSocketExtensionParameter *)parameter

Declared In

KGWebSocketFactory.h

setClientIdentity:

Sets Client Identity for SSL client certificate authentication. The Client Identity set in KGWebSocketFactory will be inherited by the KGWebSocket created from this factory.

- (void)setClientIdentity:(SecIdentityRef)clientIdentity

Parameters

clientIdentity

SecIdentityRef for authentication

Declared In

KGWebSocketFactory.h

setDefaultChallengeHandler:

Sets the default KGChallengeHandler that is used during authentication both at the connect-time as well as at subsequent revalidation-time that occurs at regular intervals. All the KGWebSocket instances created using this factory will inherit the default ChallengeHandler.

- (void)setDefaultChallengeHandler:(KGChallengeHandler *)challengeHandler

Declared In

KGWebSocketFactory.h

setDefaultConnectTimeout:

Sets the default connect timeout in milliseconds. The specified timeout is inherited by all the WebSocket instances that are created using this WebSocketFactory instance. The timeout will expire if there is no exchange of packets(for example, 100% packet loss) while establishing the connection. A timeout value of zero indicates no timeout.

- (void)setDefaultConnectTimeout:(int)connectTimeout

Parameters

connectTimeout

timeout value in milliseconds

Exceptions

NSInvalidArgumentException

if connectTimeout is negative

Declared In

KGWebSocketFactory.h

setDefaultEnabledExtensions:

Registers the names of all the default enabled extensions to be inherited by all the KGWebSocket objects created using this factory. The extensions will be negotiated between the client and the server during the WebSocket handshake if all the required parameters belonging to the extension have been set.

- (void)setDefaultEnabledExtensions:(NSArray *)extensions

Discussion

Warning: If the required parameter is missing for any of the enabled extension, the KGWebSocket created won’t be able to connect and will throw exception on [KGWebSocket connect]

Declared In

KGWebSocketFactory.h

setDefaultParameter:value:

Sets the default value of the specified KGWebSocketExtensionParameter that will be inherited by all the KGWebSocket instances that are created using this factory instance. KGWebSocket created before setting the parameter using this API will not be able to inherit the default value of the parameter.

- (void)setDefaultParameter:(KGWebSocketExtensionParameter *)parameter value:(id)value

Declared In

KGWebSocketFactory.h