@react-native-ohos/react-native-tcp-socket 6.3.1-rc.2 → 6.3.1-rc.3
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/harmony/tcp_socket/oh-package.json5 +1 -1
- package/harmony/tcp_socket.har +0 -0
- package/lib/types/Globals.d.ts +1 -1
- package/lib/types/Server.d.ts +4 -4
- package/lib/types/Socket.d.ts +11 -15
- package/lib/types/TLSServer.d.ts +0 -19
- package/lib/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/lib/types/TcpSocketModule.d.ts +0 -18
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").DeviceEventEmitter;
|
|
2
2
|
export function getNextId(): number;
|
package/lib/types/Server.d.ts
CHANGED
|
@@ -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").
|
|
29
|
+
protected readonly _eventEmitter: import("react-native").EventEmitter;
|
|
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) => void) | undefined): Server;
|
|
79
|
+
close(callback?: ((err?: Error | undefined) => 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(
|
|
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";
|
package/lib/types/Socket.d.ts
CHANGED
|
@@ -35,10 +35,6 @@
|
|
|
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();
|
|
42
38
|
/** @package */
|
|
43
39
|
_id: number;
|
|
44
40
|
/** @private */
|
|
@@ -139,7 +135,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
139
135
|
*
|
|
140
136
|
* @param {BufferEncoding} [encoding]
|
|
141
137
|
*/
|
|
142
|
-
setEncoding(encoding?:
|
|
138
|
+
setEncoding(encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined): Socket;
|
|
143
139
|
/**
|
|
144
140
|
* Enable/disable the use of Nagle's algorithm. When a TCP connection is created, it will have Nagle's algorithm enabled.
|
|
145
141
|
*
|
|
@@ -172,7 +168,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
172
168
|
* @param {string | Buffer | Uint8Array} [data]
|
|
173
169
|
* @param {BufferEncoding} [encoding]
|
|
174
170
|
*/
|
|
175
|
-
end(data?: string | Buffer | Uint8Array | undefined, encoding?:
|
|
171
|
+
end(data?: string | Buffer | Uint8Array | undefined, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined): Socket;
|
|
176
172
|
/**
|
|
177
173
|
* Ensures that no more I/O activity happens on this socket. Destroys the stream and closes the connection.
|
|
178
174
|
*/
|
|
@@ -191,7 +187,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
191
187
|
*
|
|
192
188
|
* @return {boolean}
|
|
193
189
|
*/
|
|
194
|
-
write(buffer: string | Buffer | Uint8Array, encoding?:
|
|
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;
|
|
195
191
|
/**
|
|
196
192
|
* Pauses the reading of data. That is, `'data'` events will not be emitted. Useful to throttle back an upload.
|
|
197
193
|
*/
|
|
@@ -235,7 +231,7 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
|
|
|
235
231
|
private _setDisconnected;
|
|
236
232
|
}
|
|
237
233
|
export type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
|
238
|
-
export type NativeEventEmitter = import(
|
|
234
|
+
export type NativeEventEmitter = import("react-native").NativeEventEmitter;
|
|
239
235
|
export type AddressInfo = {
|
|
240
236
|
address: string;
|
|
241
237
|
family: string;
|
|
@@ -250,13 +246,13 @@ export type NativeConnectionInfo = {
|
|
|
250
246
|
};
|
|
251
247
|
export type ConnectionOptions = {
|
|
252
248
|
port: number;
|
|
253
|
-
host?: string;
|
|
254
|
-
localAddress?: string;
|
|
255
|
-
localPort?: number;
|
|
256
|
-
interface?:
|
|
257
|
-
reuseAddress?: boolean;
|
|
258
|
-
tls?: boolean;
|
|
259
|
-
tlsCheckValidity?: boolean;
|
|
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;
|
|
260
256
|
tlsCert?: any;
|
|
261
257
|
};
|
|
262
258
|
export type ReadableEvents = {
|
package/lib/types/TLSServer.d.ts
CHANGED
|
@@ -15,25 +15,6 @@ 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;
|
|
37
18
|
/**
|
|
38
19
|
* @private
|
|
39
20
|
*/
|
package/lib/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare namespace _default {
|
|
|
11
11
|
export { Socket };
|
|
12
12
|
export { TLSServer };
|
|
13
13
|
export { TLSSocket };
|
|
14
|
-
export const hasIdentity:
|
|
14
|
+
export const hasIdentity: typeof import("./TLSSocket").default.hasIdentity;
|
|
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.
|
|
4
|
+
"version": "6.3.1-rc.3",
|
|
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",
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|