react-native-macos 0.68.67 → 0.68.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/WebSocket/RCTReconnectingWebSocket.m +10 -10
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTWebSocketExecutor.mm +10 -10
- package/React/CoreModules/RCTWebSocketModule.mm +13 -13
- package/React/CoreModules/React-CoreModules.podspec +2 -0
- package/React/DevSupport/RCTPackagerConnection.mm +1 -1
- package/React/Inspector/RCTInspector.mm +0 -1
- package/React/Inspector/RCTInspectorPackagerConnection.m +10 -10
- package/React-Core.podspec +2 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/template/Gemfile.lock +2 -2
- package/template/package.json +1 -1
- package/Libraries/WebSocket/RCTSRWebSocket.h +0 -132
- package/Libraries/WebSocket/RCTSRWebSocket.m +0 -1682
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
#import <React/RCTConvert.h>
|
|
11
11
|
#import <React/RCTDefines.h>
|
|
12
12
|
|
|
13
|
-
#import <
|
|
13
|
+
#import <SocketRocket/SRWebSocket.h>
|
|
14
14
|
|
|
15
15
|
#if RCT_DEV // Only supported in dev mode
|
|
16
16
|
|
|
17
|
-
@interface RCTReconnectingWebSocket () <
|
|
17
|
+
@interface RCTReconnectingWebSocket () <SRWebSocketDelegate>
|
|
18
18
|
@end
|
|
19
19
|
|
|
20
20
|
@implementation RCTReconnectingWebSocket {
|
|
21
21
|
NSURL *_url;
|
|
22
|
-
|
|
22
|
+
SRWebSocket *_socket;
|
|
23
23
|
BOOL _stopped;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
|
|
40
40
|
- (void)send:(id)data
|
|
41
41
|
{
|
|
42
|
-
[_socket
|
|
42
|
+
[_socket sendData:data error:nil];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
- (void)start
|
|
46
46
|
{
|
|
47
47
|
[self stop];
|
|
48
48
|
_stopped = NO;
|
|
49
|
-
_socket = [[
|
|
49
|
+
_socket = [[SRWebSocket alloc] initWithURL:_url];
|
|
50
50
|
_socket.delegate = self;
|
|
51
51
|
[_socket setDelegateDispatchQueue:_delegateDispatchQueue];
|
|
52
52
|
[_socket open];
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
_socket = nil;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
- (void)webSocket:(
|
|
63
|
+
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message
|
|
64
64
|
{
|
|
65
65
|
[_delegate reconnectingWebSocket:self didReceiveMessage:message];
|
|
66
66
|
}
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
__weak
|
|
74
|
+
__weak SRWebSocket *socket = _socket;
|
|
75
75
|
__weak __typeof(self) weakSelf = self;
|
|
76
76
|
|
|
77
77
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
- (void)webSocketDidOpen:(
|
|
85
|
+
- (void)webSocketDidOpen:(SRWebSocket *)webSocket
|
|
86
86
|
{
|
|
87
87
|
[_delegate reconnectingWebSocketDidOpen:self];
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
- (void)webSocket:(
|
|
90
|
+
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error
|
|
91
91
|
{
|
|
92
92
|
[_delegate reconnectingWebSocketDidClose:self];
|
|
93
93
|
if ([error code] != ECONNREFUSED) {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
- (void)webSocket:(
|
|
98
|
+
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
|
|
99
99
|
{
|
|
100
100
|
[_delegate reconnectingWebSocketDidClose:self];
|
|
101
101
|
[self reconnect];
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
#import <React/RCTConvert.h>
|
|
13
13
|
#import <React/RCTDefines.h>
|
|
14
14
|
#import <React/RCTLog.h>
|
|
15
|
-
#import <React/RCTSRWebSocket.h>
|
|
16
15
|
#import <React/RCTUtils.h>
|
|
17
16
|
|
|
18
17
|
#import <ReactCommon/RCTTurboModule.h>
|
|
18
|
+
#import <SocketRocket/SRWebSocket.h>
|
|
19
19
|
|
|
20
20
|
#import "CoreModulesPlugins.h"
|
|
21
21
|
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
|
|
24
24
|
typedef void (^RCTWSMessageCallback)(NSError *error, NSDictionary<NSString *, id> *reply);
|
|
25
25
|
|
|
26
|
-
@interface RCTWebSocketExecutor () <
|
|
26
|
+
@interface RCTWebSocketExecutor () <SRWebSocketDelegate, RCTTurboModule>
|
|
27
27
|
|
|
28
28
|
@end
|
|
29
29
|
|
|
30
30
|
@implementation RCTWebSocketExecutor {
|
|
31
|
-
|
|
31
|
+
SRWebSocket *_socket;
|
|
32
32
|
dispatch_queue_t _jsQueue;
|
|
33
33
|
NSMutableDictionary<NSNumber *, RCTWSMessageCallback> *_callbacks;
|
|
34
34
|
dispatch_semaphore_t _socketOpenSemaphore;
|
|
@@ -62,7 +62,7 @@ RCT_EXPORT_MODULE()
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
_jsQueue = dispatch_queue_create("com.facebook.react.WebSocketExecutor", DISPATCH_QUEUE_SERIAL);
|
|
65
|
-
_socket = [[
|
|
65
|
+
_socket = [[SRWebSocket alloc] initWithURL:_url];
|
|
66
66
|
_socket.delegate = self;
|
|
67
67
|
_callbacks = [NSMutableDictionary new];
|
|
68
68
|
_injectedObjects = [NSMutableDictionary new];
|
|
@@ -112,7 +112,7 @@ RCT_EXPORT_MODULE()
|
|
|
112
112
|
_socketOpenSemaphore = dispatch_semaphore_create(0);
|
|
113
113
|
[_socket open];
|
|
114
114
|
long connected = dispatch_semaphore_wait(_socketOpenSemaphore, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 15));
|
|
115
|
-
return connected == 0 && _socket.readyState ==
|
|
115
|
+
return connected == 0 && _socket.readyState == SR_OPEN;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
- (BOOL)prepareJSRuntime
|
|
@@ -131,7 +131,7 @@ RCT_EXPORT_MODULE()
|
|
|
131
131
|
return runtimeIsReady == 0 && initError == nil;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
- (void)webSocket:(
|
|
134
|
+
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message
|
|
135
135
|
{
|
|
136
136
|
NSError *error = nil;
|
|
137
137
|
NSDictionary<NSString *, id> *reply = RCTJSONParse(message, &error);
|
|
@@ -143,12 +143,12 @@ RCT_EXPORT_MODULE()
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
- (void)webSocketDidOpen:(
|
|
146
|
+
- (void)webSocketDidOpen:(SRWebSocket *)webSocket
|
|
147
147
|
{
|
|
148
148
|
dispatch_semaphore_signal(_socketOpenSemaphore);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
- (void)webSocket:(
|
|
151
|
+
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error
|
|
152
152
|
{
|
|
153
153
|
dispatch_semaphore_signal(_socketOpenSemaphore);
|
|
154
154
|
RCTLogInfo(@"WebSocket connection failed with error %@", error);
|
|
@@ -173,7 +173,7 @@ RCT_EXPORT_MODULE()
|
|
|
173
173
|
self->_callbacks[expectedID] = [callback copy];
|
|
174
174
|
NSMutableDictionary<NSString *, id> *messageWithID = [message mutableCopy];
|
|
175
175
|
messageWithID[@"id"] = expectedID;
|
|
176
|
-
[self->_socket
|
|
176
|
+
[self->_socket sendString:RCTJSONStringify(messageWithID, NULL) error:nil];
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -270,7 +270,7 @@ RCT_EXPORT_MODULE()
|
|
|
270
270
|
|
|
271
271
|
- (BOOL)isValid
|
|
272
272
|
{
|
|
273
|
-
return _socket != nil && _socket.readyState ==
|
|
273
|
+
return _socket != nil && _socket.readyState == SR_OPEN;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
- (void)dealloc
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
#import <FBReactNativeSpec/FBReactNativeSpec.h>
|
|
13
13
|
#import <React/RCTConvert.h>
|
|
14
|
-
#import <React/RCTSRWebSocket.h>
|
|
15
14
|
#import <React/RCTUtils.h>
|
|
15
|
+
#import <SocketRocket/SRWebSocket.h>
|
|
16
16
|
|
|
17
17
|
#import "CoreModulesPlugins.h"
|
|
18
18
|
|
|
19
|
-
@implementation
|
|
19
|
+
@implementation SRWebSocket (React)
|
|
20
20
|
|
|
21
21
|
- (NSNumber *)reactTag
|
|
22
22
|
{
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
|
|
31
31
|
@end
|
|
32
32
|
|
|
33
|
-
@interface RCTWebSocketModule () <
|
|
33
|
+
@interface RCTWebSocketModule () <SRWebSocketDelegate, NativeWebSocketModuleSpec>
|
|
34
34
|
|
|
35
35
|
@end
|
|
36
36
|
|
|
37
37
|
@implementation RCTWebSocketModule {
|
|
38
|
-
NSMutableDictionary<NSNumber *,
|
|
38
|
+
NSMutableDictionary<NSNumber *, SRWebSocket *> *_sockets;
|
|
39
39
|
NSMutableDictionary<NSNumber *, id<RCTWebSocketContentHandler>> *_contentHandlers;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -56,7 +56,7 @@ RCT_EXPORT_MODULE()
|
|
|
56
56
|
[super invalidate];
|
|
57
57
|
|
|
58
58
|
_contentHandlers = nil;
|
|
59
|
-
for (
|
|
59
|
+
for (SRWebSocket *socket in _sockets.allValues) {
|
|
60
60
|
socket.delegate = nil;
|
|
61
61
|
[socket close];
|
|
62
62
|
}
|
|
@@ -92,7 +92,7 @@ RCT_EXPORT_METHOD(connect
|
|
|
92
92
|
}];
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
SRWebSocket *webSocket = [[SRWebSocket alloc] initWithURLRequest:request protocols:protocols];
|
|
96
96
|
[webSocket setDelegateDispatchQueue:[self methodQueue]];
|
|
97
97
|
webSocket.delegate = self;
|
|
98
98
|
webSocket.reactTag = @(socketID);
|
|
@@ -106,7 +106,7 @@ RCT_EXPORT_METHOD(connect
|
|
|
106
106
|
|
|
107
107
|
RCT_EXPORT_METHOD(send : (NSString *)message forSocketID : (double)socketID)
|
|
108
108
|
{
|
|
109
|
-
[_sockets[@(socketID)]
|
|
109
|
+
[_sockets[@(socketID)] sendString:message error:nil];
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
RCT_EXPORT_METHOD(sendBinary : (NSString *)base64String forSocketID : (double)socketID)
|
|
@@ -116,12 +116,12 @@ RCT_EXPORT_METHOD(sendBinary : (NSString *)base64String forSocketID : (double)so
|
|
|
116
116
|
|
|
117
117
|
- (void)sendData:(NSData *)data forSocketID:(NSNumber *__nonnull)socketID
|
|
118
118
|
{
|
|
119
|
-
[_sockets[socketID]
|
|
119
|
+
[_sockets[socketID] sendData:data error:nil];
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
RCT_EXPORT_METHOD(ping : (double)socketID)
|
|
123
123
|
{
|
|
124
|
-
[_sockets[@(socketID)] sendPing:
|
|
124
|
+
[_sockets[@(socketID)] sendPing:nil error:nil];
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
RCT_EXPORT_METHOD(close : (double)code reason : (NSString *)reason socketID : (double)socketID)
|
|
@@ -140,7 +140,7 @@ RCT_EXPORT_METHOD(close : (double)code reason : (NSString *)reason socketID : (d
|
|
|
140
140
|
|
|
141
141
|
#pragma mark - RCTSRWebSocketDelegate methods
|
|
142
142
|
|
|
143
|
-
- (void)webSocket:(
|
|
143
|
+
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message
|
|
144
144
|
{
|
|
145
145
|
NSString *type;
|
|
146
146
|
|
|
@@ -160,13 +160,13 @@ RCT_EXPORT_METHOD(close : (double)code reason : (NSString *)reason socketID : (d
|
|
|
160
160
|
[self sendEventWithName:@"websocketMessage" body:@{@"data" : message, @"type" : type, @"id" : webSocket.reactTag}];
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
- (void)webSocketDidOpen:(
|
|
163
|
+
- (void)webSocketDidOpen:(SRWebSocket *)webSocket
|
|
164
164
|
{
|
|
165
165
|
[self sendEventWithName:@"websocketOpen"
|
|
166
166
|
body:@{@"id" : webSocket.reactTag, @"protocol" : webSocket.protocol ? webSocket.protocol : @""}];
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
- (void)webSocket:(
|
|
169
|
+
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error
|
|
170
170
|
{
|
|
171
171
|
NSNumber *socketID = [webSocket reactTag];
|
|
172
172
|
_contentHandlers[socketID] = nil;
|
|
@@ -176,7 +176,7 @@ RCT_EXPORT_METHOD(close : (double)code reason : (NSString *)reason socketID : (d
|
|
|
176
176
|
[self sendEventWithName:@"websocketFailed" body:body];
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
- (void)webSocket:(
|
|
179
|
+
- (void)webSocket:(SRWebSocket *)webSocket
|
|
180
180
|
didCloseWithCode:(NSInteger)code
|
|
181
181
|
reason:(NSString *)reason
|
|
182
182
|
wasClean:(BOOL)wasClean
|
|
@@ -18,6 +18,7 @@ end
|
|
|
18
18
|
|
|
19
19
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
20
20
|
folly_version = '2021.06.28.00-v2'
|
|
21
|
+
socket_rocket_version = '0.6.0'
|
|
21
22
|
|
|
22
23
|
Pod::Spec.new do |s|
|
|
23
24
|
s.name = "React-CoreModules"
|
|
@@ -48,4 +49,5 @@ Pod::Spec.new do |s|
|
|
|
48
49
|
s.dependency "React-RCTImage", version
|
|
49
50
|
s.dependency "ReactCommon/turbomodule/core", version
|
|
50
51
|
s.dependency "React-jsi", version
|
|
52
|
+
s.dependency "SocketRocket", socket_rocket_version
|
|
51
53
|
end
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
#import <React/RCTDefines.h>
|
|
13
13
|
#import <React/RCTInspector.h>
|
|
14
14
|
#import <React/RCTLog.h>
|
|
15
|
-
#import <React/RCTSRWebSocket.h>
|
|
16
15
|
#import <React/RCTUtils.h>
|
|
16
|
+
#import <SocketRocket/SRWebSocket.h>
|
|
17
17
|
|
|
18
18
|
// This is a port of the Android impl, at
|
|
19
19
|
// ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java
|
|
@@ -24,10 +24,10 @@ const int RECONNECT_DELAY_MS = 2000;
|
|
|
24
24
|
@implementation RCTBundleStatus
|
|
25
25
|
@end
|
|
26
26
|
|
|
27
|
-
@interface RCTInspectorPackagerConnection () <
|
|
27
|
+
@interface RCTInspectorPackagerConnection () <SRWebSocketDelegate> {
|
|
28
28
|
NSURL *_url;
|
|
29
29
|
NSMutableDictionary<NSString *, RCTInspectorLocalConnection *> *_inspectorConnections;
|
|
30
|
-
|
|
30
|
+
SRWebSocket *_webSocket;
|
|
31
31
|
dispatch_queue_t _jsQueue;
|
|
32
32
|
BOOL _closed;
|
|
33
33
|
BOOL _suppressConnectionErrors;
|
|
@@ -188,7 +188,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// analogous to InspectorPackagerConnection.Connection.onFailure(...)
|
|
191
|
-
- (void)webSocket:(__unused
|
|
191
|
+
- (void)webSocket:(__unused SRWebSocket *)webSocket didFailWithError:(NSError *)error
|
|
192
192
|
{
|
|
193
193
|
if (_webSocket) {
|
|
194
194
|
[self abort:@"Websocket exception" withCause:error];
|
|
@@ -199,7 +199,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
// analogous to InspectorPackagerConnection.Connection.onMessage(...)
|
|
202
|
-
- (void)webSocket:(__unused
|
|
202
|
+
- (void)webSocket:(__unused SRWebSocket *)webSocket didReceiveMessage:(id)opaqueMessage
|
|
203
203
|
{
|
|
204
204
|
// warn but don't die on unrecognized messages
|
|
205
205
|
if (![opaqueMessage isKindOfClass:[NSString class]]) {
|
|
@@ -219,7 +219,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// analogous to InspectorPackagerConnection.Connection.onClosed(...)
|
|
222
|
-
- (void)webSocket:(__unused
|
|
222
|
+
- (void)webSocket:(__unused SRWebSocket *)webSocket
|
|
223
223
|
didCloseWithCode:(__unused NSInteger)code
|
|
224
224
|
reason:(__unused NSString *)reason
|
|
225
225
|
wasClean:(__unused BOOL)wasClean
|
|
@@ -244,9 +244,9 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
// The corresponding android code has a lot of custom config options for
|
|
247
|
-
// timeouts, but
|
|
248
|
-
// implemented options.
|
|
249
|
-
_webSocket = [[
|
|
247
|
+
// timeouts, but our previous class, RCTSRWebSocket didn't have the same
|
|
248
|
+
// implemented options. Might be worth reinvestigating for SRWebSocket?
|
|
249
|
+
_webSocket = [[SRWebSocket alloc] initWithURL:_url];
|
|
250
250
|
[_webSocket setDelegateDispatchQueue:_jsQueue];
|
|
251
251
|
_webSocket.delegate = self;
|
|
252
252
|
[_webSocket open];
|
|
@@ -290,7 +290,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
|
290
290
|
if (error) {
|
|
291
291
|
RCTLogWarn(@"Couldn't send event to packager: %@", error);
|
|
292
292
|
} else {
|
|
293
|
-
[strongSelf->_webSocket
|
|
293
|
+
[strongSelf->_webSocket sendString:messageText error:nil];
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
});
|
package/React-Core.podspec
CHANGED
|
@@ -18,6 +18,7 @@ end
|
|
|
18
18
|
|
|
19
19
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
20
20
|
folly_version = '2021.06.28.00-v2'
|
|
21
|
+
socket_rocket_version = '0.6.0'
|
|
21
22
|
boost_compiler_flags = '-Wno-documentation'
|
|
22
23
|
|
|
23
24
|
header_subspecs = {
|
|
@@ -104,6 +105,7 @@ Pod::Spec.new do |s|
|
|
|
104
105
|
s.dependency "React-perflogger", version
|
|
105
106
|
s.dependency "React-jsi", version
|
|
106
107
|
s.dependency "React-jsiexecutor", version
|
|
108
|
+
s.dependency "SocketRocket", socket_rocket_version
|
|
107
109
|
s.dependency "Yoga"
|
|
108
110
|
s.dependency "glog"
|
|
109
111
|
end
|
package/package.json
CHANGED
package/template/Gemfile.lock
CHANGED
|
@@ -8,7 +8,7 @@ GEM
|
|
|
8
8
|
i18n (>= 1.6, < 2)
|
|
9
9
|
minitest (>= 5.1)
|
|
10
10
|
tzinfo (~> 2.0)
|
|
11
|
-
addressable (2.8.
|
|
11
|
+
addressable (2.8.3)
|
|
12
12
|
public_suffix (>= 2.0.2, < 6.0)
|
|
13
13
|
algoliasearch (1.27.5)
|
|
14
14
|
httpclient (~> 2.8, >= 2.8.3)
|
|
@@ -95,4 +95,4 @@ RUBY VERSION
|
|
|
95
95
|
ruby 3.0.5p211
|
|
96
96
|
|
|
97
97
|
BUNDLED WITH
|
|
98
|
-
2.4.
|
|
98
|
+
2.4.10
|
package/template/package.json
CHANGED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2012 Square Inc.
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
#import <Foundation/Foundation.h>
|
|
18
|
-
#import <Security/SecCertificate.h>
|
|
19
|
-
|
|
20
|
-
typedef NS_ENUM(unsigned int, RCTSRReadyState) {
|
|
21
|
-
RCTSR_CONNECTING = 0,
|
|
22
|
-
RCTSR_OPEN = 1,
|
|
23
|
-
RCTSR_CLOSING = 2,
|
|
24
|
-
RCTSR_CLOSED = 3,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
typedef NS_ENUM(NSInteger, RCTSRStatusCode) {
|
|
28
|
-
RCTSRStatusCodeNormal = 1000,
|
|
29
|
-
RCTSRStatusCodeGoingAway = 1001,
|
|
30
|
-
RCTSRStatusCodeProtocolError = 1002,
|
|
31
|
-
RCTSRStatusCodeUnhandledType = 1003,
|
|
32
|
-
// 1004 reserved.
|
|
33
|
-
RCTSRStatusNoStatusReceived = 1005,
|
|
34
|
-
// 1004-1006 reserved.
|
|
35
|
-
RCTSRStatusCodeInvalidUTF8 = 1007,
|
|
36
|
-
RCTSRStatusCodePolicyViolated = 1008,
|
|
37
|
-
RCTSRStatusCodeMessageTooBig = 1009,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
@class RCTSRWebSocket;
|
|
41
|
-
|
|
42
|
-
extern NSString *const RCTSRWebSocketErrorDomain;
|
|
43
|
-
extern NSString *const RCTSRHTTPResponseErrorKey;
|
|
44
|
-
|
|
45
|
-
#pragma mark - RCTSRWebSocketDelegate
|
|
46
|
-
|
|
47
|
-
@protocol RCTSRWebSocketDelegate;
|
|
48
|
-
|
|
49
|
-
#pragma mark - RCTSRWebSocket
|
|
50
|
-
|
|
51
|
-
@interface RCTSRWebSocket : NSObject <NSStreamDelegate>
|
|
52
|
-
|
|
53
|
-
@property (nonatomic, weak) id<RCTSRWebSocketDelegate> delegate;
|
|
54
|
-
|
|
55
|
-
@property (nonatomic, readonly) RCTSRReadyState readyState;
|
|
56
|
-
@property (nonatomic, readonly, strong) NSURL *url;
|
|
57
|
-
|
|
58
|
-
// This returns the negotiated protocol.
|
|
59
|
-
// It will be nil until after the handshake completes.
|
|
60
|
-
@property (nonatomic, readonly, copy) NSString *protocol;
|
|
61
|
-
|
|
62
|
-
// Protocols should be an array of strings that turn into Sec-WebSocket-Protocol.
|
|
63
|
-
- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray<NSString *> *)protocols NS_DESIGNATED_INITIALIZER;
|
|
64
|
-
- (instancetype)initWithURLRequest:(NSURLRequest *)request;
|
|
65
|
-
|
|
66
|
-
// Some helper constructors.
|
|
67
|
-
- (instancetype)initWithURL:(NSURL *)url protocols:(NSArray<NSString *> *)protocols;
|
|
68
|
-
- (instancetype)initWithURL:(NSURL *)url;
|
|
69
|
-
|
|
70
|
-
// Delegate queue will be dispatch_main_queue by default.
|
|
71
|
-
// You cannot set both OperationQueue and dispatch_queue.
|
|
72
|
-
- (void)setDelegateOperationQueue:(NSOperationQueue *)queue;
|
|
73
|
-
- (void)setDelegateDispatchQueue:(dispatch_queue_t)queue;
|
|
74
|
-
|
|
75
|
-
// By default, it will schedule itself on +[NSRunLoop RCTSR_networkRunLoop] using defaultModes.
|
|
76
|
-
- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode;
|
|
77
|
-
- (void)unscheduleFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode;
|
|
78
|
-
|
|
79
|
-
// RCTSRWebSockets are intended for one-time-use only. Open should be called once and only once.
|
|
80
|
-
- (void)open;
|
|
81
|
-
|
|
82
|
-
- (void)close;
|
|
83
|
-
- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason;
|
|
84
|
-
|
|
85
|
-
// Send a UTF8 String or Data.
|
|
86
|
-
- (void)send:(id)data;
|
|
87
|
-
|
|
88
|
-
// Send Data (can be nil) in a ping message.
|
|
89
|
-
- (void)sendPing:(NSData *)data;
|
|
90
|
-
|
|
91
|
-
@end
|
|
92
|
-
|
|
93
|
-
#pragma mark - RCTSRWebSocketDelegate
|
|
94
|
-
|
|
95
|
-
@protocol RCTSRWebSocketDelegate <NSObject>
|
|
96
|
-
|
|
97
|
-
// message will either be an NSString if the server is using text
|
|
98
|
-
// or NSData if the server is using binary.
|
|
99
|
-
- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message;
|
|
100
|
-
|
|
101
|
-
@optional
|
|
102
|
-
|
|
103
|
-
- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket;
|
|
104
|
-
- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error;
|
|
105
|
-
- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
|
|
106
|
-
- (void)webSocket:(RCTSRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload;
|
|
107
|
-
|
|
108
|
-
@end
|
|
109
|
-
|
|
110
|
-
#pragma mark - NSURLRequest (CertificateAdditions)
|
|
111
|
-
|
|
112
|
-
@interface NSURLRequest (CertificateAdditions)
|
|
113
|
-
|
|
114
|
-
@property (nonatomic, readonly, copy) NSArray *RCTSR_SSLPinnedCertificates;
|
|
115
|
-
|
|
116
|
-
@end
|
|
117
|
-
|
|
118
|
-
#pragma mark - NSMutableURLRequest (CertificateAdditions)
|
|
119
|
-
|
|
120
|
-
@interface NSMutableURLRequest (CertificateAdditions)
|
|
121
|
-
|
|
122
|
-
@property (nonatomic, copy) NSArray *RCTSR_SSLPinnedCertificates;
|
|
123
|
-
|
|
124
|
-
@end
|
|
125
|
-
|
|
126
|
-
#pragma mark - NSRunLoop (RCTSRWebSocket)
|
|
127
|
-
|
|
128
|
-
@interface NSRunLoop (RCTSRWebSocket)
|
|
129
|
-
|
|
130
|
-
+ (NSRunLoop *)RCTSR_networkRunLoop;
|
|
131
|
-
|
|
132
|
-
@end
|