-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from DyKnow/feature-dev
2.0.2 Release
- Loading branch information
Showing
133 changed files
with
4,641 additions
and
8,709 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// ConnectionStatusConnection.h | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/1/16. | ||
// | ||
// | ||
|
||
#import "SignalR.h" | ||
|
||
@interface ConnectionStatusConnection : SRHubConnection | ||
|
||
+ (instancetype)sharedConnection; | ||
|
||
- (void)ping; | ||
|
||
- (void)setPongBlock:(void (^)(void))block; | ||
- (void)setJoinedBlock:(void (^)(NSString *connectionId, NSString *when))block; | ||
- (void)setRejoinedBlock:(void (^)(NSString *connectionId, NSString *when))block; | ||
- (void)setLeaveBlock:(void (^)(NSString *connectionId, NSString *when))block; | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// | ||
// ConnectionStatusConnection.m | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/1/16. | ||
// | ||
// | ||
|
||
#import "ConnectionStatusConnection.h" | ||
|
||
static NSString * const SRConnectionBaseURLString = @"http://abill-win10:9090/"; | ||
|
||
typedef void (^SRPongBlock)(); | ||
typedef void (^SRConnectionStatusBlock)(NSString *connectionId, NSString *when); | ||
|
||
@interface ConnectionStatusConnection () | ||
|
||
@property (strong, nonatomic, readwrite) SRHubProxy * hub; | ||
|
||
@property (readwrite, nonatomic, copy) SRPongBlock pong; | ||
@property (readwrite, nonatomic, copy) SRConnectionStatusBlock joined; | ||
@property (readwrite, nonatomic, copy) SRConnectionStatusBlock rejoined; | ||
@property (readwrite, nonatomic, copy) SRConnectionStatusBlock leave; | ||
|
||
@end | ||
|
||
@implementation ConnectionStatusConnection | ||
|
||
+ (instancetype)sharedConnection { | ||
static ConnectionStatusConnection *_sharedConnection = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
_sharedConnection = [[ConnectionStatusConnection alloc] initWithURLString:SRConnectionBaseURLString]; | ||
}); | ||
|
||
return _sharedConnection; | ||
} | ||
|
||
- (instancetype)initWithURLString:(NSString *)url { | ||
self = [super initWithURLString:url]; | ||
if (!self) { | ||
return nil; | ||
} | ||
|
||
_hub = [self createHubProxy:@"statushub"]; | ||
[_hub on:@"pong" perform:self selector:@selector(handlePong)]; | ||
[_hub on:@"joined" perform:self selector:@selector(handleJoined:when:)]; | ||
[_hub on:@"rejoined" perform:self selector:@selector(handleRejoined:when:)]; | ||
[_hub on:@"leave" perform:self selector:@selector(handleLeave:when:)]; | ||
|
||
return self; | ||
} | ||
|
||
- (void)ping { | ||
[self.hub invoke:@"ping" withArgs:@[] completionHandler:nil]; | ||
} | ||
|
||
- (void)setPongBlock:(void (^)(void))block { | ||
self.pong = block; | ||
} | ||
|
||
- (void)setJoinedBlock:(void (^)(NSString *connectionId, NSString *when))block; { | ||
self.joined = block; | ||
} | ||
|
||
- (void)setRejoinedBlock:(void (^)(NSString *connectionId, NSString *when))block; { | ||
self.rejoined = block; | ||
} | ||
|
||
- (void)setLeaveBlock:(void (^)(NSString *connectionId, NSString *when))block; { | ||
self.leave = block; | ||
} | ||
|
||
#pragma mark - | ||
#pragma mark Private | ||
|
||
- (void)handlePong { | ||
if(self.pong) { | ||
self.pong(); | ||
} | ||
} | ||
|
||
- (void)handleJoined:(NSString *)connectionId when:(NSString *)when { | ||
if(self.joined) { | ||
self.joined(connectionId,when); | ||
} | ||
} | ||
|
||
- (void)handleRejoined:(NSString *)connectionId when:(NSString *)when { | ||
if(self.rejoined) { | ||
self.rejoined(connectionId,when); | ||
} | ||
} | ||
|
||
- (void)handleLeave:(NSString *)connectionId when:(NSString *)when { | ||
if(self.leave) { | ||
self.leave(connectionId,when); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// DrawingPadConnection.h | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/3/16. | ||
// | ||
// | ||
|
||
#import "SignalR.h" | ||
|
||
@interface DrawingPadConnection : SRHubConnection | ||
|
||
+ (instancetype)sharedConnection; | ||
|
||
- (void)join; | ||
- (void)draw:(NSString *)line completionHandler:(void (^)(id response, NSError *error))block; | ||
|
||
- (void)setDrawBlock:(void (^)(NSDictionary *json))block; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// DrawingPadConnection.m | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/3/16. | ||
// | ||
// | ||
|
||
#import "DrawingPadConnection.h" | ||
|
||
static NSString * const SRConnectionBaseURLString = @"http://abill-win10:9090/"; | ||
|
||
typedef void (^SRConnectionDrawBlock)(NSDictionary *json); | ||
|
||
@interface DrawingPadConnection () | ||
|
||
@property (strong, nonatomic, readwrite) SRHubProxy * hub; | ||
|
||
@property (readwrite, nonatomic, copy) SRConnectionDrawBlock draw; | ||
|
||
@end | ||
|
||
@implementation DrawingPadConnection | ||
|
||
+ (instancetype)sharedConnection { | ||
static DrawingPadConnection *_sharedConnection = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
_sharedConnection = [[DrawingPadConnection alloc] initWithURLString:SRConnectionBaseURLString]; | ||
}); | ||
|
||
return _sharedConnection; | ||
} | ||
|
||
- (instancetype)initWithURLString:(NSString *)url { | ||
self = [super initWithURLString:url]; | ||
if (!self) { | ||
return nil; | ||
} | ||
|
||
_hub = [self createHubProxy:@"DrawingPad"]; | ||
[_hub on:@"draw" perform:self selector:@selector(handleDraw:)]; | ||
|
||
return self; | ||
} | ||
|
||
- (void)join { | ||
[_hub invoke:@"join" withArgs:@[] completionHandler:nil]; | ||
} | ||
|
||
- (void)draw:(NSString *)line completionHandler:(void (^)(id response, NSError *error))block; { | ||
[_hub invoke:@"draw" withArgs:@[line] completionHandler:block]; | ||
} | ||
|
||
- (void)setDrawBlock:(void (^)(NSDictionary *json))block { | ||
self.draw = block; | ||
} | ||
|
||
- (void)handleDraw:(NSDictionary *)json { | ||
if(self.draw) { | ||
self.draw(json); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// MouseTrackingConnection.h | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/2/16. | ||
// | ||
// | ||
|
||
#import "SignalR.h" | ||
|
||
@interface MouseTrackingConnection : SRHubConnection | ||
|
||
+ (instancetype)sharedConnection; | ||
|
||
- (void)join; | ||
- (void)move:(CGPoint)point completionHandler:(void (^)(id response, NSError *error))block; | ||
|
||
- (void)setMoveBlock:(void (^)(NSString *connectionId, NSNumber *x, NSNumber *y))block; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// MouseTrackingConnection.m | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/2/16. | ||
// | ||
// | ||
|
||
#import "MouseTrackingConnection.h" | ||
|
||
static NSString * const SRConnectionBaseURLString = @"http://abill-win10:9090/"; | ||
|
||
typedef void (^SRConnectionMouseMoveBlock)(NSString *connectionId, NSNumber *x, NSNumber *y); | ||
|
||
@interface MouseTrackingConnection () | ||
|
||
@property (strong, nonatomic, readwrite) SRHubProxy * hub; | ||
|
||
@property (readwrite, nonatomic, copy) SRConnectionMouseMoveBlock move; | ||
|
||
@end | ||
|
||
@implementation MouseTrackingConnection | ||
|
||
+ (instancetype)sharedConnection { | ||
static MouseTrackingConnection *_sharedConnection = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
_sharedConnection = [[MouseTrackingConnection alloc] initWithURLString:SRConnectionBaseURLString]; | ||
}); | ||
|
||
return _sharedConnection; | ||
} | ||
|
||
- (instancetype)initWithURLString:(NSString *)url { | ||
self = [super initWithURLString:url]; | ||
if (!self) { | ||
return nil; | ||
} | ||
|
||
_hub = [self createHubProxy:@"MouseTracking"]; | ||
[_hub on:@"move" perform:self selector:@selector(handleMove:x:y:)]; | ||
|
||
return self; | ||
} | ||
|
||
- (void)join { | ||
[_hub invoke:@"join" withArgs:@[] completionHandler:nil]; | ||
} | ||
|
||
- (void)move:(CGPoint)point completionHandler:(void (^)(id response, NSError *error))block; { | ||
[_hub invoke:@"move" withArgs:@[@(point.x), @(point.y)] completionHandler:block]; | ||
} | ||
|
||
- (void)setMoveBlock:(void (^)(NSString *connectionId, NSNumber *x, NSNumber *y))block { | ||
self.move = block; | ||
} | ||
|
||
- (void)handleMove:(NSString *)connectionId x:(NSNumber *)x y:(NSNumber *)y { | ||
if(self.move) { | ||
self.move(connectionId,x,y); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// RawConnection.h | ||
// SignalR.Client.ObjC Example | ||
// | ||
// Created by Alex Billingsley on 3/1/16. | ||
// | ||
// | ||
|
||
#import "SignalR.h" | ||
|
||
@interface RawConnection : SRConnection | ||
|
||
+ (instancetype)sharedConnection; | ||
|
||
- (void)sendMessage:(NSString *)message completionHandler:(void (^)(id response, NSError *error))block; | ||
- (void)broadcastMessage:(NSString *)message completionHandler:(void (^)(id response, NSError *error))block; | ||
- (void)broadcastMessageExceptMe:(NSString *)message completionHandler:(void (^)(id response, NSError *error))block; | ||
|
||
- (void)join:(NSString *)username completionHandler:(void (^)(id response, NSError *error))block; | ||
- (void)sendMessage:(NSString *)message toUser:(NSString *)username completionHandler:(void (^)(id response, NSError *error))block; | ||
|
||
- (void)joinGroup:(NSString *)group completionHandler:(void (^)(id response, NSError *error))block; | ||
- (void)sendMessage:(NSString *)message toGroup:(NSString *)group completionHandler:(void (^)(id response, NSError *error))block; | ||
- (void)leaveGroup:(NSString *)group completionHandler:(void (^)(id response, NSError *error))block; | ||
|
||
@end |
Oops, something went wrong.