Start exposing RCTWebSocketObserver using a protocol

Reviewed By: javache

Differential Revision: D4296387

fbshipit-source-id: 33f92c36168dcb18356d0ccdaf902a84634d94b7
This commit is contained in:
Adam Ernst 2016-12-08 07:28:12 -08:00 committed by Facebook Github Bot
parent 574e3daf9f
commit 2ca6138852
3 changed files with 15 additions and 8 deletions

View File

@ -12,6 +12,9 @@
#if RCT_DEV // Only supported in dev mode
@interface RCTWebSocketObserver : NSObject <RCTWebSocketObserver>
@end
@interface RCTWebSocketManager : NSObject <RCTWebSocketProxy>
@end

View File

@ -20,18 +20,15 @@
#pragma mark - RCTWebSocketObserver
@interface RCTWebSocketObserver : NSObject <RCTSRWebSocketDelegate> {
@interface RCTWebSocketObserver () <RCTSRWebSocketDelegate>
@end
@implementation RCTWebSocketObserver {
NSURL *_url;
RCTSRWebSocket *_socket;
}
- (instancetype)initWithURL:(NSURL *)url;
@property (nonatomic, weak) id<RCTWebSocketProxyDelegate> delegate;
@end
@implementation RCTWebSocketObserver
@synthesize delegate = _delegate;
- (instancetype)initWithURL:(NSURL *)url
{

View File

@ -12,6 +12,13 @@
#if RCT_DEV // Only supported in dev mode
@protocol RCTWebSocketProxyDelegate;
@protocol RCTWebSocketObserver
- (instancetype)initWithURL:(NSURL *)url;
@property (nonatomic, weak) id<RCTWebSocketProxyDelegate> delegate;
@end
@protocol RCTWebSocketProxy
+ (instancetype)sharedInstance;