Inherits from NSObject
Declared in SRHubProxy.h

Overview

An SRHubProxy object provides support for SignalR Hubs

Tasks

Properties

Initializing an SRHubProxy Object

Subscription Management

State Management

Extensions Methods

Properties

connection

The SRConnection object corresponding to underlying SRConnection

@property (strong, nonatomic, readonly) SRConnection *connection

Declared In

SRHubProxy.h

hubName

The NSString object corresponding to the hubname

@property (strong, nonatomic, readonly) NSString *hubName

Declared In

SRHubProxy.h

state

An NSMutableDictionary object that manages the state of the SignalR Hub

@property (strong, nonatomic, readonly) NSMutableDictionary *state

Declared In

SRHubProxy.h

subscriptions

An NSMutableDictionary object that manages the SRSubscriptions that have been defined on the hub

@property (strong, nonatomic, readonly) NSMutableDictionary *subscriptions

Declared In

SRHubProxy.h

Instance Methods

getMember:

Returns the object corresponding to name in the state dictionary

- (id)getMember:(NSString *)name

Parameters

name

the key for which to return the corresponding value.

Return Value

Returns the value associated with a given key.

Declared In

SRHubProxy.h

getSubscriptions

an NSArray object of the subscription event names

- (NSArray *)getSubscriptions

Return Value

an NSArray object of the subscription event names

Declared In

SRHubProxy.h

getValue:

An extension method for accessing objects contained in the SRHubProxy state dictionary

- (id)getValue:(NSString *)name

Parameters

name

the key for which to return the corresponding value.

Return Value

Returns the value associated with a given key.

Declared In

SRHubProxyExtensions.h

initWithConnection:hubName:

Initializes a new SRHubProxy object with the specified SRConnection and hubname

- (id)initWithConnection:(SRConnection *)connection hubName:(NSString *)hubname

Parameters

connection

the connection to initialize the hub on

hubname

an NSString representing the hubname

Return Value

an SRHubProxy object

Discussion

Important the hubname needs to be the full type name of the hub.

Declared In

SRHubProxy.h

invoke:withArgs:

Invokes a SignalR Server Hub method with the specified method name and arguments calls [self inoke:method arg:args continueWith:nil];

- (void)invoke:(NSString *)method withArgs:(NSArray *)args

Parameters

method

the NSString object representing the name of the server method to invoke

args

the arguments to pass as part of the invocation

Declared In

SRHubProxy.h

invoke:withArgs:continueWith:

Invokes a SignalR Server Hub method with the specified method name and arguments

- (void)invoke:(NSString *)method withArgs:(NSArray *)args continueWith:(void ( ^ ) ( id data ))responseBlock

Parameters

method

the NSString object representing the name of the server method to invoke

args

the arguments to pass as part of the invocation

responseBlock

the block to be called once the server method is invoked, this may be nil

Declared In

SRHubProxy.h

invokeEvent:withArgs:

Invokes the SRSubscription object that corresponds to eventName

- (void)invokeEvent:(NSString *)eventName withArgs:(NSArray *)args

Parameters

eventName

the NSString object representing the name of the subscription event

args

the arguments to pass as part of the invocation

Declared In

SRHubProxy.h

observe:

Initalizes an SRHubservable with the specified eventName

- (SRHubservable *)observe:(NSString *)eventName

Parameters

eventName

the NSString object representing the name of the subscription event

Return Value

an SRHubservable object

Declared In

SRHubProxyExtensions.h

on:perform:selector:

Creates a new SRSubscription object

- (SRSubscription *)on:(NSString *)eventName perform:(NSObject *)object selector:(SEL)selector

Parameters

eventName

the name of the event to subscribe to

object

The receiver to perform selector on

selector

A selector identifying the message to send.

Return Value

An instance of an SRSubscription object

Declared In

SRHubProxyExtensions.h

setMember:object:

Adds a given key-value pair to the state dictionary.

- (void)setMember:(NSString *)name object:(id)value

Parameters

name

The key for value

value

The value for key.

Declared In

SRHubProxy.h

subscribe:

Adds a new SRSubscription to the hubproxy for eventName

- (SRSubscription *)subscribe:(NSString *)eventName

Parameters

eventName

the NSString object representing the name of the subscription event

Return Value

the SRSubscription object created

Declared In

SRHubProxy.h