@react-native-ohos/react-native-tcp-socket 6.3.1-rc.1 → 6.3.1-rc.2

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.
Files changed (28) hide show
  1. package/README.md +1 -1
  2. package/harmony/tcp_socket/oh-package.json5 +1 -1
  3. package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/BaseReactNativeTcpSocketPackage.h +72 -72
  4. package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/turbo_modules/TcpSocketModule.cpp +28 -28
  5. package/harmony/tcp_socket/src/main/cpp/generated/RNOH/generated/turbo_modules/TcpSocketModule.h +16 -16
  6. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ComponentDescriptors.h +24 -24
  7. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/EventEmitters.cpp +16 -16
  8. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/EventEmitters.h +17 -17
  9. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/Props.cpp +19 -19
  10. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/Props.h +18 -18
  11. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ShadowNodes.cpp +17 -17
  12. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/ShadowNodes.h +23 -23
  13. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/States.cpp +16 -16
  14. package/harmony/tcp_socket/src/main/cpp/generated/react/renderer/components/react_native_tcp_socket/States.h +18 -18
  15. package/harmony/tcp_socket/src/main/ets/generated/components/ts.ts +5 -5
  16. package/harmony/tcp_socket/src/main/ets/generated/index.ets +5 -5
  17. package/harmony/tcp_socket/src/main/ets/generated/ts.ts +6 -6
  18. package/harmony/tcp_socket/src/main/ets/generated/turboModules/TcpSocketModule.ts +38 -38
  19. package/harmony/tcp_socket/src/main/ets/generated/turboModules/ts.ts +5 -5
  20. package/harmony/tcp_socket.har +0 -0
  21. package/lib/types/Globals.d.ts +1 -1
  22. package/lib/types/Server.d.ts +4 -4
  23. package/lib/types/Socket.d.ts +15 -11
  24. package/lib/types/TLSServer.d.ts +19 -0
  25. package/lib/types/TcpSocketModule.d.ts +18 -0
  26. package/lib/types/index.d.ts +2 -2
  27. package/package.json +1 -1
  28. package/src/Server.js +1 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @react-native-ohos/react-native-tcp-socket
2
2
 
3
- This project is based on [react-native-tcp-socket](https://github.com/Rapsssito/react-native-tcp-socket)
3
+ This project is based on [react-native-tcp-socket@6.3.0](https://github.com/Rapsssito/react-native-tcp-socket/tree/v6.3.0)
4
4
 
5
5
  ## Documentation
6
6
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-tcp-socket",
3
- "version": "6.3.1-rc.1",
3
+ "version": "6.3.1-rc.2",
4
4
  "description": "Please describe the basic information.",
5
5
  "main": "Index.ets",
6
6
  "author": "",
@@ -1,72 +1,72 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- #pragma once
6
-
7
- #include "RNOH/Package.h"
8
- #include "RNOH/ArkTSTurboModule.h"
9
- #include "RNOH/generated/turbo_modules/TcpSocketModule.h"
10
-
11
- namespace rnoh {
12
-
13
- class BaseReactNativeTcpSocketPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
14
- public:
15
- SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
16
- if (name == "TcpSocketModule") {
17
- return std::make_shared<TcpSocketModule>(ctx, name);
18
- }
19
- return nullptr;
20
- };
21
- };
22
-
23
- class BaseReactNativeTcpSocketPackageEventEmitRequestHandler : public EventEmitRequestHandler {
24
- public:
25
- void handleEvent(Context const &ctx) override {
26
- auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
27
- auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
28
-
29
- if (eventEmitter == nullptr) {
30
- return;
31
- }
32
-
33
- std::vector<std::string> supportedComponentNames = {
34
- };
35
-
36
- std::vector<std::string> supportedEventNames = {
37
- };
38
-
39
- if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
40
- std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
41
- eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
42
- }
43
- }
44
- };
45
-
46
-
47
- class BaseReactNativeTcpSocketPackage : public Package {
48
- public:
49
- BaseReactNativeTcpSocketPackage(Package::Context ctx) : Package(ctx){};
50
-
51
- std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
52
- return std::make_unique<BaseReactNativeTcpSocketPackageTurboModuleFactoryDelegate>();
53
- }
54
-
55
- std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
56
- return {
57
- };
58
- }
59
-
60
- ComponentJSIBinderByString createComponentJSIBinderByName() override {
61
- return {
62
- };
63
- };
64
-
65
- EventEmitRequestHandlers createEventEmitRequestHandlers() override {
66
- return {
67
- std::make_shared<BaseReactNativeTcpSocketPackageEventEmitRequestHandler>(),
68
- };
69
- }
70
- };
71
-
72
- } // namespace rnoh
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/Package.h"
8
+ #include "RNOH/ArkTSTurboModule.h"
9
+ #include "RNOH/generated/turbo_modules/TcpSocketModule.h"
10
+
11
+ namespace rnoh {
12
+
13
+ class BaseReactNativeTcpSocketPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
14
+ public:
15
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
16
+ if (name == "TcpSocketModule") {
17
+ return std::make_shared<TcpSocketModule>(ctx, name);
18
+ }
19
+ return nullptr;
20
+ };
21
+ };
22
+
23
+ class BaseReactNativeTcpSocketPackageEventEmitRequestHandler : public EventEmitRequestHandler {
24
+ public:
25
+ void handleEvent(Context const &ctx) override {
26
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
27
+ auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
28
+
29
+ if (eventEmitter == nullptr) {
30
+ return;
31
+ }
32
+
33
+ std::vector<std::string> supportedComponentNames = {
34
+ };
35
+
36
+ std::vector<std::string> supportedEventNames = {
37
+ };
38
+
39
+ if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
40
+ std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
41
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
42
+ }
43
+ }
44
+ };
45
+
46
+
47
+ class BaseReactNativeTcpSocketPackage : public Package {
48
+ public:
49
+ BaseReactNativeTcpSocketPackage(Package::Context ctx) : Package(ctx){};
50
+
51
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
52
+ return std::make_unique<BaseReactNativeTcpSocketPackageTurboModuleFactoryDelegate>();
53
+ }
54
+
55
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
56
+ return {
57
+ };
58
+ }
59
+
60
+ ComponentJSIBinderByString createComponentJSIBinderByName() override {
61
+ return {
62
+ };
63
+ };
64
+
65
+ EventEmitRequestHandlers createEventEmitRequestHandlers() override {
66
+ return {
67
+ std::make_shared<BaseReactNativeTcpSocketPackageEventEmitRequestHandler>(),
68
+ };
69
+ }
70
+ };
71
+
72
+ } // namespace rnoh
@@ -1,28 +1,28 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- #include "TcpSocketModule.h"
6
-
7
- namespace rnoh {
8
- using namespace facebook;
9
-
10
- TcpSocketModule::TcpSocketModule(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
11
- methodMap_ = {
12
- ARK_METHOD_METADATA(listen, 2),
13
- ARK_METHOD_METADATA(close, 1),
14
- ARK_METHOD_METADATA(destroy, 1),
15
- ARK_METHOD_METADATA(end, 1),
16
- ARK_METHOD_METADATA(pause, 1),
17
- ARK_METHOD_METADATA(resume, 1),
18
- ARK_METHOD_METADATA(connect, 4),
19
- ARK_METHOD_METADATA(startTLS, 2),
20
- ARK_METHOD_METADATA(write, 3),
21
- ARK_METHOD_METADATA(setNoDelay, 2),
22
- ARK_METHOD_METADATA(setKeepAlive, 3),
23
- ARK_ASYNC_METHOD_METADATA(getPeerCertificate, 1),
24
- ARK_ASYNC_METHOD_METADATA(getCertificate, 1),
25
- };
26
- }
27
-
28
- } // namespace rnoh
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #include "TcpSocketModule.h"
6
+
7
+ namespace rnoh {
8
+ using namespace facebook;
9
+
10
+ TcpSocketModule::TcpSocketModule(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
11
+ methodMap_ = {
12
+ ARK_METHOD_METADATA(listen, 2),
13
+ ARK_METHOD_METADATA(close, 1),
14
+ ARK_METHOD_METADATA(destroy, 1),
15
+ ARK_METHOD_METADATA(end, 1),
16
+ ARK_METHOD_METADATA(pause, 1),
17
+ ARK_METHOD_METADATA(resume, 1),
18
+ ARK_METHOD_METADATA(connect, 4),
19
+ ARK_METHOD_METADATA(startTLS, 2),
20
+ ARK_METHOD_METADATA(write, 3),
21
+ ARK_METHOD_METADATA(setNoDelay, 2),
22
+ ARK_METHOD_METADATA(setKeepAlive, 3),
23
+ ARK_ASYNC_METHOD_METADATA(getPeerCertificate, 1),
24
+ ARK_ASYNC_METHOD_METADATA(getCertificate, 1),
25
+ };
26
+ }
27
+
28
+ } // namespace rnoh
@@ -1,16 +1,16 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- #pragma once
6
-
7
- #include "RNOH/ArkTSTurboModule.h"
8
-
9
- namespace rnoh {
10
-
11
- class JSI_EXPORT TcpSocketModule : public ArkTSTurboModule {
12
- public:
13
- TcpSocketModule(const ArkTSTurboModule::Context ctx, const std::string name);
14
- };
15
-
16
- } // namespace rnoh
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/ArkTSTurboModule.h"
8
+
9
+ namespace rnoh {
10
+
11
+ class JSI_EXPORT TcpSocketModule : public ArkTSTurboModule {
12
+ public:
13
+ TcpSocketModule(const ArkTSTurboModule::Context ctx, const std::string name);
14
+ };
15
+
16
+ } // namespace rnoh
@@ -1,24 +1,24 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateComponentDescriptorH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include "ShadowNodes.h"
14
- #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
- #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
-
17
- namespace facebook::react {
18
-
19
-
20
-
21
- void react_native_tcp_socket_registerComponentDescriptorsFromCodegen(
22
- std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
-
24
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "ShadowNodes.h"
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ void react_native_tcp_socket_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -1,16 +1,16 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateEventEmitterCpp.js
9
- */
10
-
11
- #include "EventEmitters.h"
12
-
13
-
14
- namespace facebook::react {
15
-
16
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include "EventEmitters.h"
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ } // namespace facebook::react
@@ -1,17 +1,17 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateEventEmitterH.js
9
- */
10
- #pragma once
11
-
12
- #include <react/renderer/components/view/ViewEventEmitter.h>
13
-
14
-
15
- namespace facebook::react {
16
-
17
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+
17
+ } // namespace facebook::react
@@ -1,19 +1,19 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GeneratePropsCpp.js
9
- */
10
-
11
- #include "Props.h"
12
- #include <react/renderer/core/PropsParserContext.h>
13
- #include <react/renderer/core/propsConversions.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
-
19
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include "Props.h"
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -1,18 +1,18 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GeneratePropsH.js
9
- */
10
- #pragma once
11
-
12
-
13
-
14
- namespace facebook::react {
15
-
16
-
17
-
18
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+
17
+
18
+ } // namespace facebook::react
@@ -1,17 +1,17 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateShadowNodeCpp.js
9
- */
10
-
11
- #include "ShadowNodes.h"
12
-
13
- namespace facebook::react {
14
-
15
-
16
-
17
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include "ShadowNodes.h"
12
+
13
+ namespace facebook::react {
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -1,23 +1,23 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateShadowNodeH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include "EventEmitters.h"
14
- #include "Props.h"
15
- #include "States.h"
16
- #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
- #include <jsi/jsi.h>
18
-
19
- namespace facebook::react {
20
-
21
-
22
-
23
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "EventEmitters.h"
14
+ #include "Props.h"
15
+ #include "States.h"
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook::react {
20
+
21
+
22
+
23
+ } // namespace facebook::react
@@ -1,16 +1,16 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateStateCpp.js
9
- */
10
- #include "States.h"
11
-
12
- namespace facebook::react {
13
-
14
-
15
-
16
- } // namespace facebook::react
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateStateCpp.js
9
+ */
10
+ #include "States.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+ } // namespace facebook::react
@@ -1,19 +1,19 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateStateH.js
8
- */
9
- #pragma once
10
-
11
- #ifdef ANDROID
12
- #include <folly/dynamic.h>
13
- #endif
14
-
15
- namespace facebook::react {
16
-
17
-
18
-
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ #ifdef ANDROID
12
+ #include <folly/dynamic.h>
13
+ #endif
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
19
  } // namespace facebook::react
@@ -1,5 +1,5 @@
1
-
2
- /**
3
- */
4
-
5
- export {}
1
+
2
+ /**
3
+ */
4
+
5
+ export {}
@@ -1,5 +1,5 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- export * from "./ts"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./ts"
@@ -1,6 +1,6 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- export * as RNC from "./components/ts"
6
- export * as TM from "./turboModules/ts"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * as RNC from "./components/ts"
6
+ export * as TM from "./turboModules/ts"
@@ -1,38 +1,38 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- import { Tag } from "@rnoh/react-native-openharmony/ts"
6
-
7
- export namespace TcpSocketModule {
8
- export const NAME = 'TcpSocketModule' as const
9
-
10
- export interface Spec {
11
- listen(cId: number, options: Object): void;
12
-
13
- close(cid: number): void;
14
-
15
- destroy(cid: number): void;
16
-
17
- end(cid: number): void;
18
-
19
- pause(cid: number): void;
20
-
21
- resume(cid: number): void;
22
-
23
- connect(cId: number, host: string, port: number, options: Object): void;
24
-
25
- startTLS(cId: number, tlsOptions: Object): void;
26
-
27
- write(cId: number, base64String: string, msgId: number): void;
28
-
29
- setNoDelay(cId: number, noDelay: boolean): void;
30
-
31
- setKeepAlive(cId: number, enable: boolean, initialDelay: number): void;
32
-
33
- getPeerCertificate(cId: number): Promise<string>;
34
-
35
- getCertificate(cId: number): Promise<string>;
36
-
37
- }
38
- }
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import { Tag } from "@rnoh/react-native-openharmony/ts"
6
+
7
+ export namespace TcpSocketModule {
8
+ export const NAME = 'TcpSocketModule' as const
9
+
10
+ export interface Spec {
11
+ listen(cId: number, options: Object): void;
12
+
13
+ close(cid: number): void;
14
+
15
+ destroy(cid: number): void;
16
+
17
+ end(cid: number): void;
18
+
19
+ pause(cid: number): void;
20
+
21
+ resume(cid: number): void;
22
+
23
+ connect(cId: number, host: string, port: number, options: Object): void;
24
+
25
+ startTLS(cId: number, tlsOptions: Object): void;
26
+
27
+ write(cId: number, base64String: string, msgId: number): void;
28
+
29
+ setNoDelay(cId: number, noDelay: boolean): void;
30
+
31
+ setKeepAlive(cId: number, enable: boolean, initialDelay: number): void;
32
+
33
+ getPeerCertificate(cId: number): Promise<string>;
34
+
35
+ getCertificate(cId: number): Promise<string>;
36
+
37
+ }
38
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- export * from "./TcpSocketModule"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./TcpSocketModule"
Binary file
@@ -1,2 +1,2 @@
1
- export const nativeEventEmitter: import("react-native").DeviceEventEmitter;
1
+ export const nativeEventEmitter: import("react-native").DeviceEventEmitterStatic;
2
2
  export function getNextId(): number;
@@ -26,7 +26,7 @@ export default class Server extends EventEmitter<ServerEvents, any> {
26
26
  /** @protected @readonly */
27
27
  protected readonly _id: number;
28
28
  /** @protected @readonly */
29
- protected readonly _eventEmitter: import("react-native").EventEmitter;
29
+ protected readonly _eventEmitter: import("react-native").DeviceEventEmitterStatic;
30
30
  /** @private @type {Set<Socket>} */
31
31
  private _connections;
32
32
  /** @private */
@@ -76,7 +76,7 @@ export default class Server extends EventEmitter<ServerEvents, any> {
76
76
  * @param {(err?: Error) => void} [callback] Called when the server is closed.
77
77
  * @returns {Server}
78
78
  */
79
- close(callback?: ((err?: Error | undefined) => void) | undefined): Server;
79
+ close(callback?: ((err?: Error) => void) | undefined): Server;
80
80
  /**
81
81
  * Returns the bound `address`, the address `family` name, and `port` of the server as reported by the operating system if listening
82
82
  * on an IP socket (useful to find which port was assigned when getting an OS-assigned address):
@@ -126,7 +126,7 @@ export type ServerOptions = {
126
126
  allowHalfOpen?: boolean | undefined;
127
127
  pauseOnConnect?: boolean | undefined;
128
128
  };
129
- export type TLSSocket = import("./TLSSocket").default;
129
+ export type TLSSocket = import('./TLSSocket').default;
130
130
  export type ServerEvents = {
131
131
  close: () => void;
132
132
  connection: (socket: Socket) => void;
@@ -135,4 +135,4 @@ export type ServerEvents = {
135
135
  secureConnection: (tlsSocket: TLSSocket) => void;
136
136
  };
137
137
  import EventEmitter from "eventemitter3";
138
- import Socket from "./Socket";
138
+ import Socket from "./Socket";
@@ -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?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined): Socket;
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?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined): Socket;
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?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined, cb?: ((err?: Error | undefined) => void) | undefined): boolean;
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("react-native").NativeEventEmitter;
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 | undefined;
250
- localAddress?: string | undefined;
251
- localPort?: number | undefined;
252
- interface?: "wifi" | "cellular" | "ethernet" | undefined;
253
- reuseAddress?: boolean | undefined;
254
- tls?: boolean | undefined;
255
- tlsCheckValidity?: boolean | undefined;
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 = {
@@ -15,6 +15,25 @@ export default class TLSServer extends Server {
15
15
  setSecureContext(options: TLSServerOptions): void;
16
16
  /** @private */
17
17
  private _options;
18
+ /**
19
+ * Start a server listening for connections.
20
+ *
21
+ * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted.
22
+ * The last parameter `callback` will be added as a listener for the `'listening'` event.
23
+ *
24
+ * The `server.listen()` method can be called again if and only if there was an error during the first
25
+ * `server.listen()` call or `server.close()` has been called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN`
26
+ * error will be thrown.
27
+ *
28
+ * @param {{ port: number; host: string; reuseAddress?: boolean}} options
29
+ * @param {() => void} [callback]
30
+ * @override
31
+ */
32
+ override listen(options: {
33
+ port: number;
34
+ host: string;
35
+ reuseAddress?: boolean;
36
+ }, callback?: (() => void) | undefined): Server;
18
37
  /**
19
38
  * @private
20
39
  */
@@ -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;
@@ -11,7 +11,7 @@ declare namespace _default {
11
11
  export { Socket };
12
12
  export { TLSServer };
13
13
  export { TLSSocket };
14
- export const hasIdentity: typeof import("./TLSSocket").default.hasIdentity;
14
+ export const hasIdentity: any;
15
15
  }
16
16
  export default _default;
17
17
  export type ServerOptions = {
@@ -78,4 +78,4 @@ declare function isIPv6(input: string): boolean;
78
78
  import Server from "./Server";
79
79
  import Socket from "./Socket";
80
80
  import TLSServer from "./TLSServer";
81
- import TLSSocket from "./TLSSocket";
81
+ import TLSSocket from "./TLSSocket";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-tcp-socket",
3
3
  "title": "React Native Tcp Socket",
4
- "version": "6.3.1-rc.1",
4
+ "version": "6.3.1-rc.2",
5
5
  "description": "React Native TCP socket API for HarmonyOS with SSL/TLS support",
6
6
  "main": "src/index.js",
7
7
  "types": "lib/types/index.d.ts",
package/src/Server.js CHANGED
@@ -105,6 +105,7 @@ export default class Server extends EventEmitter {
105
105
  port: options.port,
106
106
  host: options.host || '0.0.0.0',
107
107
  reuseAddress: options.reuseAddress,
108
+ tls: options.tls
108
109
  };
109
110
  if (typeof callback_or_host === 'function') {
110
111
  cb = callback_or_host;