react-native/Libraries
Rob Hogan cd9d6e34fd WebSocket API change to make room for other connection options (SSL pinning)
Summary:
This is a simple groundwork PR to allow options to be passed to the `WebSocket` constructor. It represents a minor change to an undocumented part of the API, moving `headers` to within `options`.

This will be a BC for anyone manually specifying headers other than `origin` but a) that's not a common use case with WebSockets and b) it's not documented even in code and wouldn't currently pass a flow check.

NB: The third argument to the WebSocket constructor isn't part of the W3C spec, so I think this is a good place for RN-specific named parameters, better than adding a fourth argument. `protocols` needs to stay where it is, in line with the spec.

If this goes through I'd like to build on it by adding an additional connection option for SSL certificate pinning, as already supported by the underlying `okhttp` and `RCTSRWebSocket`. It could later be expanded for various other uses.

Currently, there's no way for a `WebSocket` user to specify any connection options other than url, protocol and headers. The fact that `WebSocket` connects in its constructor means any options have to go in there.

Connect to a websocket server using iOS and Android, observe the connection headers:
1. Without specifying `origin`, the default header should be set
2. Specifying it in the old way `new WebSocket(url, protocols, { origin: 'customorigin.com' })`
3. Specifying it in the new way `new WebSocket(url, protocols, { headers: { origin: 'customorigin.com' }})`.

I've tested myself using the test app with iOS and Android.
Closes https://github.com/facebook/react-native/pull/15334

Differential Revision: D5601675

Pulled By: javache

fbshipit-source-id: 5959d03a3e1d269b2c6775f3e0cf071ff08617bf
2017-08-10 06:02:42 -07:00
..
ART Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
ActionSheetIOS Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Alert Export Alert's type ButtonsArray for external use 2017-03-06 12:44:47 -08:00
Animated React 16 beta 5 sync (5495e49...c3718c4) 2017-08-09 12:35:30 -07:00
AppState Added stubs for some native modules 2017-06-01 08:31:19 -07:00
BatchedBridge Increase information logged to MessageQueue.spy 2017-07-31 06:16:41 -07:00
Blob Configure requiresMainQueueSetup for core modules 2017-08-07 07:04:36 -07:00
BugReporting Patch up for future React Sync 2017-02-08 14:50:43 -08:00
CameraRoll Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Components Fix destructuring-style PropTypes references 2017-08-09 23:52:51 -07:00
Core Bring back React Stack support 2017-08-10 04:17:27 -07:00
EventEmitter Breaking - make RCTDeviceEventEmitter warnings fatal 2017-07-24 03:47:59 -07:00
Experimental Fixes unintended side effects caused by #14684 2017-08-01 14:10:31 -07:00
Geolocation Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Image RCTImage: Use C atomics instead of OSAtomic 2017-08-01 02:51:03 -07:00
Inspector Use fixed point in inspector 2017-07-06 14:52:28 -07:00
Interaction Increase information logged to MessageQueue.spy 2017-07-31 06:16:41 -07:00
JSInspector Add Network agent 2016-11-02 12:29:15 -07:00
LayoutAnimation Fix prop-types warning in LayoutAnimation 2017-05-12 15:06:17 -07:00
Linking Docs: fix typo in deeplinking docs 2017-07-26 07:18:44 -07:00
LinkingIOS Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Lists Fix stale separator props and expose CellRenderer refs 2017-08-08 17:01:39 -07:00
Modal Update Modal.js 2017-07-26 07:18:44 -07:00
NativeAnimation Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Network Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Performance Bring back React Stack support 2017-08-10 04:17:27 -07:00
PermissionsAndroid Include Create React Native App in Getting Started 2017-04-26 07:16:18 -07:00
PushNotificationIOS Set alertTitle in UILocalNotification 2017-08-06 20:22:21 -07:00
RCTTest Wait for bridge to disappear when running tests 2017-08-09 09:50:44 -07:00
ReactNative Report native warnings to YellowBox 2017-08-04 07:56:14 -07:00
Renderer Bring back React Stack support 2017-08-10 04:17:27 -07:00
Sample Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
Settings Fix infinite recursion in RCTSettingsManager init 2017-08-09 09:39:40 -07:00
Share Flowify Process Color 2017-04-26 11:31:56 -07:00
Storage correctly order ASyncStorage 2017-02-21 15:18:40 -08:00
StyleSheet update docs for Transforms 2017-07-28 12:49:01 -07:00
Text Fix TextInput numeric keyboard submit 2017-08-10 03:36:36 -07:00
Utilities Cleanup stray markdown files, update contributing guidelines 2017-08-04 16:18:01 -07:00
Vibration Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
WebSocket WebSocket API change to make room for other connection options (SSL pinning) 2017-08-10 06:02:42 -07:00
fishhook Merge fishhook.xcodeproj in RCTWebSocket 2017-08-09 07:48:09 -07:00
polyfills Improve spacing in polyfill error messages 2017-08-10 03:56:01 -07:00
react-native Breaking - Remove AdSupportIOS 2017-07-26 13:32:41 -07:00
vendor gets Relay/Classic/Compat building 2017-07-24 21:39:00 -07:00
Promise.js Don't require prettyFormat in every single bundle. 2017-06-16 04:31:56 -07:00
promiseRejectionIsError.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00