mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Apply custom headers in RCTReconnectingWebSocket (#55611)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55611 Inject custom devsupport headers into the HMR WebSocket connection. Changes from `initWithURL:` to `initWithURLRequest:` so headers can be set on the HTTP upgrade handshake. Changelog: [Internal] [Changed] - Reviewed By: cipolleschi Differential Revision: D93596718 fbshipit-source-id: ab028d0e03e11f0efde000d19943693439236dbc
This commit is contained in:
1 parent
dd02486a6f
commit
59bc3892cb
1 file changed
+4
-1
@@ -9,6 +9,7 @@
|
||||
|
||||
#import <React/RCTConvert.h>
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTDevSupportHttpHeaders.h>
|
||||
|
||||
#import <SocketRocket/SRWebSocket.h>
|
||||
|
||||
@@ -46,7 +47,9 @@
|
||||
{
|
||||
[self stop];
|
||||
_stopped = NO;
|
||||
_socket = [[SRWebSocket alloc] initWithURL:_url];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_url];
|
||||
[[RCTDevSupportHttpHeaders sharedInstance] applyHeadersToRequest:request];
|
||||
_socket = [[SRWebSocket alloc] initWithURLRequest:request];
|
||||
_socket.delegate = self;
|
||||
[_socket setDelegateDispatchQueue:_delegateDispatchQueue];
|
||||
[_socket open];
|
||||
|
||||
Reference in new issue
Block a user