mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-30 17:33:21 +08:00
Backed out changeset 183744d2415b
Reviewed By: nicklockwood Differential Revision: D3053067 fb-gh-sync-id: de20718b5bf82eae433637847143e32b7a4bb216 shipit-source-id: de20718b5bf82eae433637847143e32b7a4bb216
This commit is contained in:
committed by
Facebook Github Bot 6
parent
fe7fcdb227
commit
cc2068e201
@@ -11,6 +11,7 @@
|
||||
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
@implementation RCTSRWebSocket (React)
|
||||
@@ -44,9 +45,14 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(connect:(NSURL *)URL protocols:(NSArray *)protocols options:(NSDictionary *)options socketID:(nonnull NSNumber *)socketID)
|
||||
RCT_EXPORT_METHOD(connect:(NSURL *)URL protocols:(NSArray *)protocols headers:(NSDictionary *)headers socketID:(nonnull NSNumber *)socketID)
|
||||
{
|
||||
RCTSRWebSocket *webSocket = [[RCTSRWebSocket alloc] initWithURL:URL protocols:protocols options:options];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
|
||||
[headers enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) {
|
||||
[request addValue:[RCTConvert NSString:value] forHTTPHeaderField:key];
|
||||
}];
|
||||
|
||||
RCTSRWebSocket *webSocket = [[RCTSRWebSocket alloc] initWithURLRequest:request protocols:protocols];
|
||||
webSocket.delegate = self;
|
||||
webSocket.reactTag = socketID;
|
||||
if (!_sockets) {
|
||||
|
||||
Reference in New Issue
Block a user