SRHubConnection Class Reference
Inherits from | SRConnection : NSObject |
Declared in | SRHubConnection.h |
Overview
An SRHubConnection
object provides an abstraction over SRConnection
and provides support for publishing and subscribing to custom events
Tasks
Properties
-
hubs
The
propertyNSMutableDictionary
object containing theSRHubProxy
objects -
+ connectionWithURL:
A convenience method for initWithURL:(NSString *)url;
-
– initWithURL:
Initializes a new
SRHubConnection
object at the specified URL -
– createProxy:
Creates a client side proxy to the hub on the server side.
-
– start:
Starts the connection for all hubs
-
– stop
Stops the connection for all hubs
Properties
hubs
The NSMutableDictionary
object containing the SRHubProxy
objects
@property (strong, nonatomic, readonly) NSMutableDictionary *hubs
Declared In
SRHubConnection.h
Class Methods
connectionWithURL:
A convenience method for initWithURL:(NSString *)url;
+ (SRHubConnection *)connectionWithURL:(NSString *)URL
Parameters
- URL
the endpoint to initialize the new connection to
Return Value
an SRHubConnection object
Discussion
SRHubConnection *connection = [SRHubConnection connectionWithURL:@“http://mysite/”]http://mysite/“];
Important: This url will not point to a specific handler. But will instead point to the root of your site.
Declared In
SRHubConnection.h
Instance Methods
createProxy:
Creates a client side proxy to the hub on the server side.
- (SRHubProxy *)createProxy:(NSString *)hubName
Parameters
- hubName
hubName the name of the hub
Return Value
SRHubProxy object
Discussion
SRHubProxy *myHub = [connection createProxy:@“MySite.MyHub”];
Important: The name of this hub needs to be the full type name of the hub.
Declared In
SRHubConnection.h
initWithURL:
Initializes a new SRHubConnection
object at the specified URL
- (id)initWithURL:(NSString *)url
Parameters
- url
the endpoint to initialize the new connection to
Return Value
an SRHubConnection object
Discussion
SRHubConnection *connection = [[SRHubConnection alloc] initWithURL:@“http://mysite/”];
Important: This url will not point to a specific handler. But will instead point to the root of your site.
Declared In
SRHubConnection.h
start:
Starts the connection for all hubs
- (void)start:(id<SRClientTransport>)transport
Parameters
- transport
the transport to use for the connection
Declared In
SRHubConnection.h