@react-native-ohos/react-native-tcp-socket 6.2.1-rc.1 → 6.2.1
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/LICENSE +21 -21
- package/README.OpenSource +10 -10
- package/README.md +12 -12
- package/harmony/tcp_socket/Index.ets +8 -8
- package/harmony/tcp_socket/build-profile.json5 +31 -31
- package/harmony/tcp_socket/hvigorfile.ts +6 -6
- package/harmony/tcp_socket/obfuscation-rules.txt +22 -22
- package/harmony/tcp_socket/oh-package.json5 +11 -11
- package/harmony/tcp_socket/src/main/cpp/CMakeLists.txt +10 -10
- package/harmony/tcp_socket/src/main/cpp/TcpSocketPackage.h +26 -26
- package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/BaseReactNativeTcpSocketPackage.h +65 -65
- package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/turbo_modules/TcpSocketModule.cpp +28 -28
- package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/turbo_modules/TcpSocketModule.h +16 -16
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ComponentDescriptors.h +22 -22
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/EventEmitters.cpp +18 -18
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/EventEmitters.h +19 -19
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/Props.cpp +21 -21
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/Props.h +20 -20
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ShadowNodes.cpp +19 -19
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ShadowNodes.h +25 -25
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/States.cpp +18 -18
- package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/States.h +22 -22
- package/harmony/tcp_socket/src/main/ets/Logger.ts +45 -45
- package/harmony/tcp_socket/src/main/ets/TcpEventListener.ts +120 -120
- package/harmony/tcp_socket/src/main/ets/TcpSocket.ts +16 -16
- package/harmony/tcp_socket/src/main/ets/TcpSocketClient.ts +443 -443
- package/harmony/tcp_socket/src/main/ets/TcpSocketPackage.ets +27 -27
- package/harmony/tcp_socket/src/main/ets/TcpSocketServer.ts +150 -150
- package/harmony/tcp_socket/src/main/ets/TcpSocketTurboModule.ts +224 -224
- package/harmony/tcp_socket/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/tcp_socket/src/main/ets/generated/index.ets +5 -5
- package/harmony/tcp_socket/src/main/ets/generated/ts.ts +6 -6
- package/harmony/tcp_socket/src/main/ets/generated/turboModules/TcpSocketModule.ts +38 -38
- package/harmony/tcp_socket/src/main/ets/generated/turboModules/ts.ts +5 -5
- package/harmony/tcp_socket/src/main/module.json5 +11 -11
- package/harmony/tcp_socket/src/main/resources/base/element/string.json +8 -8
- package/harmony/tcp_socket/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/tcp_socket/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/tcp_socket/src/ohosTest/ets/test/Ability.test.ets +34 -34
- package/harmony/tcp_socket/src/ohosTest/ets/test/List.test.ets +4 -4
- package/harmony/tcp_socket/src/ohosTest/module.json5 +13 -13
- package/harmony/tcp_socket/src/test/List.test.ets +4 -4
- package/harmony/tcp_socket/src/test/LocalUnit.test.ets +32 -32
- package/harmony/tcp_socket/ts.ets +6 -6
- package/harmony/tcp_socket.har +0 -0
- package/lib/types/Globals.d.ts +1 -1
- package/lib/types/Server.d.ts +3 -3
- package/lib/types/Socket.d.ts +15 -11
- package/lib/types/TcpSocketModule.d.ts +18 -0
- package/package.json +90 -90
- package/src/Globals.js +12 -12
- package/src/Server.js +185 -185
- package/src/Socket.js +513 -513
- package/src/TLSServer.js +70 -70
- package/src/TLSSocket.js +93 -93
- package/src/TcpSocketModule.ts +39 -39
- package/src/index.js +131 -131
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
2
|
-
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
|
3
|
-
|
|
4
|
-
export default function abilityTest() {
|
|
5
|
-
describe('ActsAbilityTest', () => {
|
|
6
|
-
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
// Presets an action, which is performed only once before all test cases of the test suite start.
|
|
9
|
-
// This API supports only one parameter: preset action function.
|
|
10
|
-
})
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
// Presets an action, which is performed before each unit test case starts.
|
|
13
|
-
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
14
|
-
// This API supports only one parameter: preset action function.
|
|
15
|
-
})
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
// Presets a clear action, which is performed after each unit test case ends.
|
|
18
|
-
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
19
|
-
// This API supports only one parameter: clear action function.
|
|
20
|
-
})
|
|
21
|
-
afterAll(() => {
|
|
22
|
-
// Presets a clear action, which is performed after all test cases of the test suite end.
|
|
23
|
-
// This API supports only one parameter: clear action function.
|
|
24
|
-
})
|
|
25
|
-
it('assertContain', 0, () => {
|
|
26
|
-
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
|
27
|
-
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
|
|
28
|
-
let a = 'abc';
|
|
29
|
-
let b = 'b';
|
|
30
|
-
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
|
31
|
-
expect(a).assertContain(b);
|
|
32
|
-
expect(a).assertEqual(a);
|
|
33
|
-
})
|
|
34
|
-
})
|
|
1
|
+
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
2
|
+
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
|
3
|
+
|
|
4
|
+
export default function abilityTest() {
|
|
5
|
+
describe('ActsAbilityTest', () => {
|
|
6
|
+
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
// Presets an action, which is performed only once before all test cases of the test suite start.
|
|
9
|
+
// This API supports only one parameter: preset action function.
|
|
10
|
+
})
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
// Presets an action, which is performed before each unit test case starts.
|
|
13
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
14
|
+
// This API supports only one parameter: preset action function.
|
|
15
|
+
})
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
// Presets a clear action, which is performed after each unit test case ends.
|
|
18
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
19
|
+
// This API supports only one parameter: clear action function.
|
|
20
|
+
})
|
|
21
|
+
afterAll(() => {
|
|
22
|
+
// Presets a clear action, which is performed after all test cases of the test suite end.
|
|
23
|
+
// This API supports only one parameter: clear action function.
|
|
24
|
+
})
|
|
25
|
+
it('assertContain', 0, () => {
|
|
26
|
+
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
|
27
|
+
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
|
|
28
|
+
let a = 'abc';
|
|
29
|
+
let b = 'b';
|
|
30
|
+
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
|
31
|
+
expect(a).assertContain(b);
|
|
32
|
+
expect(a).assertEqual(a);
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import abilityTest from './Ability.test';
|
|
2
|
-
|
|
3
|
-
export default function testsuite() {
|
|
4
|
-
abilityTest();
|
|
1
|
+
import abilityTest from './Ability.test';
|
|
2
|
+
|
|
3
|
+
export default function testsuite() {
|
|
4
|
+
abilityTest();
|
|
5
5
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"module": {
|
|
3
|
-
"name": "tcp_socket_test",
|
|
4
|
-
"type": "feature",
|
|
5
|
-
"deviceTypes": [
|
|
6
|
-
"default",
|
|
7
|
-
"tablet",
|
|
8
|
-
"2in1"
|
|
9
|
-
],
|
|
10
|
-
"deliveryWithInstall": true,
|
|
11
|
-
"installationFree": false
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "tcp_socket_test",
|
|
4
|
+
"type": "feature",
|
|
5
|
+
"deviceTypes": [
|
|
6
|
+
"default",
|
|
7
|
+
"tablet",
|
|
8
|
+
"2in1"
|
|
9
|
+
],
|
|
10
|
+
"deliveryWithInstall": true,
|
|
11
|
+
"installationFree": false
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import localUnitTest from './LocalUnit.test';
|
|
2
|
-
|
|
3
|
-
export default function testsuite() {
|
|
4
|
-
localUnitTest();
|
|
1
|
+
import localUnitTest from './LocalUnit.test';
|
|
2
|
+
|
|
3
|
+
export default function testsuite() {
|
|
4
|
+
localUnitTest();
|
|
5
5
|
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
|
2
|
-
|
|
3
|
-
export default function localUnitTest() {
|
|
4
|
-
describe('localUnitTest', () => {
|
|
5
|
-
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
|
6
|
-
beforeAll(() => {
|
|
7
|
-
// Presets an action, which is performed only once before all test cases of the test suite start.
|
|
8
|
-
// This API supports only one parameter: preset action function.
|
|
9
|
-
});
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
// Presets an action, which is performed before each unit test case starts.
|
|
12
|
-
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
13
|
-
// This API supports only one parameter: preset action function.
|
|
14
|
-
});
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
// Presets a clear action, which is performed after each unit test case ends.
|
|
17
|
-
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
18
|
-
// This API supports only one parameter: clear action function.
|
|
19
|
-
});
|
|
20
|
-
afterAll(() => {
|
|
21
|
-
// Presets a clear action, which is performed after all test cases of the test suite end.
|
|
22
|
-
// This API supports only one parameter: clear action function.
|
|
23
|
-
});
|
|
24
|
-
it('assertContain', 0, () => {
|
|
25
|
-
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
|
26
|
-
let a = 'abc';
|
|
27
|
-
let b = 'b';
|
|
28
|
-
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
|
29
|
-
expect(a).assertContain(b);
|
|
30
|
-
expect(a).assertEqual(a);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
1
|
+
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
|
2
|
+
|
|
3
|
+
export default function localUnitTest() {
|
|
4
|
+
describe('localUnitTest', () => {
|
|
5
|
+
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
// Presets an action, which is performed only once before all test cases of the test suite start.
|
|
8
|
+
// This API supports only one parameter: preset action function.
|
|
9
|
+
});
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
// Presets an action, which is performed before each unit test case starts.
|
|
12
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
13
|
+
// This API supports only one parameter: preset action function.
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
// Presets a clear action, which is performed after each unit test case ends.
|
|
17
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
18
|
+
// This API supports only one parameter: clear action function.
|
|
19
|
+
});
|
|
20
|
+
afterAll(() => {
|
|
21
|
+
// Presets a clear action, which is performed after all test cases of the test suite end.
|
|
22
|
+
// This API supports only one parameter: clear action function.
|
|
23
|
+
});
|
|
24
|
+
it('assertContain', 0, () => {
|
|
25
|
+
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
|
26
|
+
let a = 'abc';
|
|
27
|
+
let b = 'b';
|
|
28
|
+
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
|
29
|
+
expect(a).assertContain(b);
|
|
30
|
+
expect(a).assertEqual(a);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
export * from "./src/main/ets/TcpSocketPackage";
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./src/main/ets/TcpSocketPackage";
|
|
7
7
|
export * from "./src/main/ets/TcpSocketTurboModule";
|
package/harmony/tcp_socket.har
CHANGED
|
Binary file
|
package/lib/types/Globals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const nativeEventEmitter: import("react-native").
|
|
1
|
+
export const nativeEventEmitter: import("react-native").DeviceEventEmitterStatic;
|
|
2
2
|
export function getNextId(): number;
|
package/lib/types/Server.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export default class Server extends EventEmitter<ServerEvents, any> {
|
|
|
18
18
|
/** @protected @readonly */
|
|
19
19
|
protected readonly _id: number;
|
|
20
20
|
/** @protected @readonly */
|
|
21
|
-
protected readonly _eventEmitter: import("react-native").
|
|
21
|
+
protected readonly _eventEmitter: import("react-native").DeviceEventEmitterStatic;
|
|
22
22
|
/** @private @type {Set<Socket>} */
|
|
23
23
|
private _connections;
|
|
24
24
|
/** @private */
|
|
@@ -65,7 +65,7 @@ export default class Server extends EventEmitter<ServerEvents, any> {
|
|
|
65
65
|
* @param {(err?: Error) => void} [callback] Called when the server is closed.
|
|
66
66
|
* @returns {Server}
|
|
67
67
|
*/
|
|
68
|
-
close(callback?: ((err?: Error
|
|
68
|
+
close(callback?: ((err?: Error) => void) | undefined): Server;
|
|
69
69
|
/**
|
|
70
70
|
* Returns the bound `address`, the address `family` name, and `port` of the server as reported by the operating system if listening
|
|
71
71
|
* on an IP socket (useful to find which port was assigned when getting an OS-assigned address):
|
|
@@ -102,7 +102,7 @@ export default class Server extends EventEmitter<ServerEvents, any> {
|
|
|
102
102
|
connection: import('./Socket').NativeConnectionInfo;
|
|
103
103
|
}): Socket;
|
|
104
104
|
}
|
|
105
|
-
export type TLSSocket = import(
|
|
105
|
+
export type TLSSocket = import('./TLSSocket').default;
|
|
106
106
|
export type ServerEvents = {
|
|
107
107
|
close: () => void;
|
|
108
108
|
connection: (socket: Socket) => void;
|
package/lib/types/Socket.d.ts
CHANGED
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
* @extends {EventEmitter<SocketEvents & ReadableEvents, any>}
|
|
36
36
|
*/
|
|
37
37
|
export default class Socket extends EventEmitter<SocketEvents & ReadableEvents, any> {
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new socket object.
|
|
40
|
+
*/
|
|
41
|
+
constructor();
|
|
38
42
|
/** @package */
|
|
39
43
|
_id: number;
|
|
40
44
|
/** @private */
|
|
@@ -135,7 +139,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
135
139
|
*
|
|
136
140
|
* @param {BufferEncoding} [encoding]
|
|
137
141
|
*/
|
|
138
|
-
setEncoding(encoding?:
|
|
142
|
+
setEncoding(encoding?: BufferEncoding | undefined): Socket;
|
|
139
143
|
/**
|
|
140
144
|
* Enable/disable the use of Nagle's algorithm. When a TCP connection is created, it will have Nagle's algorithm enabled.
|
|
141
145
|
*
|
|
@@ -168,7 +172,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
168
172
|
* @param {string | Buffer | Uint8Array} [data]
|
|
169
173
|
* @param {BufferEncoding} [encoding]
|
|
170
174
|
*/
|
|
171
|
-
end(data?: string | Buffer | Uint8Array | undefined, encoding?:
|
|
175
|
+
end(data?: string | Buffer | Uint8Array | undefined, encoding?: BufferEncoding | undefined): Socket;
|
|
172
176
|
/**
|
|
173
177
|
* Ensures that no more I/O activity happens on this socket. Destroys the stream and closes the connection.
|
|
174
178
|
*/
|
|
@@ -187,7 +191,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
187
191
|
*
|
|
188
192
|
* @return {boolean}
|
|
189
193
|
*/
|
|
190
|
-
write(buffer: string | Buffer | Uint8Array, encoding?:
|
|
194
|
+
write(buffer: string | Buffer | Uint8Array, encoding?: BufferEncoding | undefined, cb?: ((err?: Error) => void) | undefined): boolean;
|
|
191
195
|
/**
|
|
192
196
|
* Pauses the reading of data. That is, `'data'` events will not be emitted. Useful to throttle back an upload.
|
|
193
197
|
*/
|
|
@@ -231,7 +235,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
231
235
|
private _setDisconnected;
|
|
232
236
|
}
|
|
233
237
|
export type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
|
234
|
-
export type NativeEventEmitter = import(
|
|
238
|
+
export type NativeEventEmitter = import('react-native').NativeEventEmitter;
|
|
235
239
|
export type AddressInfo = {
|
|
236
240
|
address: string;
|
|
237
241
|
family: string;
|
|
@@ -246,13 +250,13 @@ export type NativeConnectionInfo = {
|
|
|
246
250
|
};
|
|
247
251
|
export type ConnectionOptions = {
|
|
248
252
|
port: number;
|
|
249
|
-
host?: string
|
|
250
|
-
localAddress?: string
|
|
251
|
-
localPort?: number
|
|
252
|
-
interface?:
|
|
253
|
-
reuseAddress?: boolean
|
|
254
|
-
tls?: boolean
|
|
255
|
-
tlsCheckValidity?: boolean
|
|
253
|
+
host?: string;
|
|
254
|
+
localAddress?: string;
|
|
255
|
+
localPort?: number;
|
|
256
|
+
interface?: 'wifi' | 'cellular' | 'ethernet';
|
|
257
|
+
reuseAddress?: boolean;
|
|
258
|
+
tls?: boolean;
|
|
259
|
+
tlsCheckValidity?: boolean;
|
|
256
260
|
tlsCert?: any;
|
|
257
261
|
};
|
|
258
262
|
export type ReadableEvents = {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
listen(cId: number, options: Object): void;
|
|
4
|
+
close(cid: number): void;
|
|
5
|
+
destroy(cid: number): void;
|
|
6
|
+
end(cid: number): void;
|
|
7
|
+
pause(cid: number): void;
|
|
8
|
+
resume(cid: number): void;
|
|
9
|
+
connect(cId: number, host: string, port: number, options: Object): void;
|
|
10
|
+
startTLS(cId: number, tlsOptions: Object): void;
|
|
11
|
+
write(cId: number, base64String: string, msgId: number): void;
|
|
12
|
+
setNoDelay(cId: number, noDelay: boolean): void;
|
|
13
|
+
setKeepAlive(cId: number, enable: boolean, initialDelay: number): void;
|
|
14
|
+
getPeerCertificate(cId: number): Promise<string>;
|
|
15
|
+
getCertificate(cId: number): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: Spec | null;
|
|
18
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@react-native-ohos/react-native-tcp-socket",
|
|
3
|
-
"title": "React Native Tcp Socket",
|
|
4
|
-
"version": "6.2.1
|
|
5
|
-
"description": "React Native TCP socket API for HarmonyOS with SSL/TLS support",
|
|
6
|
-
"main": "src/index.js",
|
|
7
|
-
"types": "lib/types/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"ci": "yarn install --frozen-lockfile && yarn lint && yarn declaration:build && yarn checkjs && yarn test",
|
|
10
|
-
"lint": "eslint .",
|
|
11
|
-
"checkjs": "tsc && tsc -p ./__tests__/tsconfig.json",
|
|
12
|
-
"test": "jest ./__tests__",
|
|
13
|
-
"declaration:build": "tsc -p ./declaration.tsconfig.json",
|
|
14
|
-
"prepublishOnly": "yarn declaration:build && yarn checkjs",
|
|
15
|
-
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-tcp-socket --cpp-output-path ./harmony/tcp_socket/src/main/cpp/generated --ets-output-path ./harmony/tcp_socket/src/main/ets/generated --turbo-modules-spec-paths ./src --arkts-components-spec-paths ./src"
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"/src",
|
|
19
|
-
"/lib",
|
|
20
|
-
"/harmony"
|
|
21
|
-
],
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket.git",
|
|
25
|
-
"baseUrl": "https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"react-native",
|
|
29
|
-
"harmony",
|
|
30
|
-
"tcp-socket",
|
|
31
|
-
"tls",
|
|
32
|
-
"ssl",
|
|
33
|
-
"tcp-server",
|
|
34
|
-
"tcp-client",
|
|
35
|
-
"tcp",
|
|
36
|
-
"react-native-library"
|
|
37
|
-
],
|
|
38
|
-
"harmony": {
|
|
39
|
-
"alias": "react-native-tcp-socket",
|
|
40
|
-
"autolinking": {
|
|
41
|
-
"etsPackageClassName":"TcpSocketPackage",
|
|
42
|
-
"cppPackageClassName":"TcpSocketPackage",
|
|
43
|
-
"cmakeLibraryTargetName": "rnoh_tcp_socket",
|
|
44
|
-
"ohPackageName": "@react-native-ohos/react-native-tcp-socket"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"funding": {
|
|
48
|
-
"type": "individual",
|
|
49
|
-
"url": "https://github.com/sponsors/Rapsssito"
|
|
50
|
-
},
|
|
51
|
-
"author": {
|
|
52
|
-
"name": "Rapsssito",
|
|
53
|
-
"email": "contact@rodrigomartin.dev"
|
|
54
|
-
},
|
|
55
|
-
"license": "MIT",
|
|
56
|
-
"licenseFilename": "LICENSE",
|
|
57
|
-
"readmeFilename": "README.md",
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"react-native": ">=0.60.0"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@babel/core": "^7.7.7",
|
|
63
|
-
"@semantic-release/changelog": "^5.0.0",
|
|
64
|
-
"@semantic-release/git": "^9.0.0",
|
|
65
|
-
"@semantic-release/github": "^7.0.0",
|
|
66
|
-
"@semantic-release/npm": "^7.0.0",
|
|
67
|
-
"@types/eventemitter3": "^2.0.2",
|
|
68
|
-
"@types/jest": "^25.1.3",
|
|
69
|
-
"@types/react-native": "^0.61.17",
|
|
70
|
-
"babel-eslint": "^10.1.0",
|
|
71
|
-
"babel-jest": "^24.9.0",
|
|
72
|
-
"eslint": "^6.8.0",
|
|
73
|
-
"eslint-config-prettier": "^6.5.0",
|
|
74
|
-
"eslint-plugin-jest": "^23.6.0",
|
|
75
|
-
"eslint-plugin-jsdoc": "^21.0.0",
|
|
76
|
-
"eslint-plugin-prettier": "^3.1.1",
|
|
77
|
-
"jest": "^26.6.3",
|
|
78
|
-
"metro-react-native-babel-preset": "^0.58.0",
|
|
79
|
-
"prettier": "^1.18.2",
|
|
80
|
-
"react": "16.9.0",
|
|
81
|
-
"react-native": "0.60.5",
|
|
82
|
-
"semantic-release": "^17.0.1",
|
|
83
|
-
"typescript": "^4.1.3"
|
|
84
|
-
},
|
|
85
|
-
"dependencies": {
|
|
86
|
-
"buffer": "^5.4.3",
|
|
87
|
-
"eventemitter3": "^4.0.7",
|
|
88
|
-
"react-native-tcp-socket": "6.2.0"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-tcp-socket",
|
|
3
|
+
"title": "React Native Tcp Socket",
|
|
4
|
+
"version": "6.2.1",
|
|
5
|
+
"description": "React Native TCP socket API for HarmonyOS with SSL/TLS support",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"ci": "yarn install --frozen-lockfile && yarn lint && yarn declaration:build && yarn checkjs && yarn test",
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"checkjs": "tsc && tsc -p ./__tests__/tsconfig.json",
|
|
12
|
+
"test": "jest ./__tests__",
|
|
13
|
+
"declaration:build": "tsc -p ./declaration.tsconfig.json",
|
|
14
|
+
"prepublishOnly": "yarn declaration:build && yarn checkjs",
|
|
15
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-tcp-socket --cpp-output-path ./harmony/tcp_socket/src/main/cpp/generated --ets-output-path ./harmony/tcp_socket/src/main/ets/generated --turbo-modules-spec-paths ./src --arkts-components-spec-paths ./src"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"/src",
|
|
19
|
+
"/lib",
|
|
20
|
+
"/harmony"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket.git",
|
|
25
|
+
"baseUrl": "https://gitcode.com/openharmony-sig/rntpc_react-native-tcp-socket"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"react-native",
|
|
29
|
+
"harmony",
|
|
30
|
+
"tcp-socket",
|
|
31
|
+
"tls",
|
|
32
|
+
"ssl",
|
|
33
|
+
"tcp-server",
|
|
34
|
+
"tcp-client",
|
|
35
|
+
"tcp",
|
|
36
|
+
"react-native-library"
|
|
37
|
+
],
|
|
38
|
+
"harmony": {
|
|
39
|
+
"alias": "react-native-tcp-socket",
|
|
40
|
+
"autolinking": {
|
|
41
|
+
"etsPackageClassName":"TcpSocketPackage",
|
|
42
|
+
"cppPackageClassName":"TcpSocketPackage",
|
|
43
|
+
"cmakeLibraryTargetName": "rnoh_tcp_socket",
|
|
44
|
+
"ohPackageName": "@react-native-ohos/react-native-tcp-socket"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"funding": {
|
|
48
|
+
"type": "individual",
|
|
49
|
+
"url": "https://github.com/sponsors/Rapsssito"
|
|
50
|
+
},
|
|
51
|
+
"author": {
|
|
52
|
+
"name": "Rapsssito",
|
|
53
|
+
"email": "contact@rodrigomartin.dev"
|
|
54
|
+
},
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"licenseFilename": "LICENSE",
|
|
57
|
+
"readmeFilename": "README.md",
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"react-native": ">=0.60.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@babel/core": "^7.7.7",
|
|
63
|
+
"@semantic-release/changelog": "^5.0.0",
|
|
64
|
+
"@semantic-release/git": "^9.0.0",
|
|
65
|
+
"@semantic-release/github": "^7.0.0",
|
|
66
|
+
"@semantic-release/npm": "^7.0.0",
|
|
67
|
+
"@types/eventemitter3": "^2.0.2",
|
|
68
|
+
"@types/jest": "^25.1.3",
|
|
69
|
+
"@types/react-native": "^0.61.17",
|
|
70
|
+
"babel-eslint": "^10.1.0",
|
|
71
|
+
"babel-jest": "^24.9.0",
|
|
72
|
+
"eslint": "^6.8.0",
|
|
73
|
+
"eslint-config-prettier": "^6.5.0",
|
|
74
|
+
"eslint-plugin-jest": "^23.6.0",
|
|
75
|
+
"eslint-plugin-jsdoc": "^21.0.0",
|
|
76
|
+
"eslint-plugin-prettier": "^3.1.1",
|
|
77
|
+
"jest": "^26.6.3",
|
|
78
|
+
"metro-react-native-babel-preset": "^0.58.0",
|
|
79
|
+
"prettier": "^1.18.2",
|
|
80
|
+
"react": "16.9.0",
|
|
81
|
+
"react-native": "0.60.5",
|
|
82
|
+
"semantic-release": "^17.0.1",
|
|
83
|
+
"typescript": "^4.1.3"
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"buffer": "^5.4.3",
|
|
87
|
+
"eventemitter3": "^4.0.7",
|
|
88
|
+
"react-native-tcp-socket": "6.2.0"
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/Globals.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DeviceEventEmitter } from 'react-native';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let instanceNumber = 0;
|
|
5
|
-
|
|
6
|
-
function getNextId() {
|
|
7
|
-
return instanceNumber++;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const nativeEventEmitter = DeviceEventEmitter;
|
|
11
|
-
|
|
12
|
-
export { nativeEventEmitter, getNextId };
|
|
1
|
+
import { DeviceEventEmitter } from 'react-native';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let instanceNumber = 0;
|
|
5
|
+
|
|
6
|
+
function getNextId() {
|
|
7
|
+
return instanceNumber++;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const nativeEventEmitter = DeviceEventEmitter;
|
|
11
|
+
|
|
12
|
+
export { nativeEventEmitter, getNextId };
|