Added an optional options parameter for WebSockets

Summary:
This enables overriding origin, and other request headers. Similar to the https://github.com/websockets/ws api.
Closes https://github.com/facebook/react-native/pull/4629

Reviewed By: svcscm

Differential Revision: D2839951

Pulled By: mkonicek

fb-gh-sync-id: 3578af4343f90572b8851ff28342a05945498ef6
This commit is contained in:
Andy Prock
2016-01-20 11:00:21 -08:00
committed by facebook-github-bot-4
parent 15f806957f
commit 9b87e6c860
6 changed files with 49 additions and 20 deletions

View File

@@ -44,9 +44,9 @@ RCT_EXPORT_MODULE()
}
}
RCT_EXPORT_METHOD(connect:(NSURL *)URL socketID:(nonnull NSNumber *)socketID)
RCT_EXPORT_METHOD(connect:(NSURL *)URL protocols:(NSArray *)protocols options:(NSDictionary *)options socketID:(nonnull NSNumber *)socketID)
{
RCTSRWebSocket *webSocket = [[RCTSRWebSocket alloc] initWithURL:URL];
RCTSRWebSocket *webSocket = [[RCTSRWebSocket alloc] initWithURL:URL protocols:protocols options:options];
webSocket.delegate = self;
webSocket.reactTag = socketID;
if (!_sockets) {