import Vnmf from '../../index' declare module '../../index' { /** One. TCP Socket Example,Default use IPv4 Agreement * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.html */ interface TCPSocket { /** Activate connection on the given package * @supported weapp * @example * ```tsx * const tcp = Vnmf.createTCPSocket() * tcp.connect({ address: '192.168.193.2', port: 8848 }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.connect.html */ connect(option: TCPSocket.connect.Option): void /** Yes. socket Send Data Up * @supported weapp * @example * ```tsx * const tcp = Vnmf.createTCPSocket() * tcp.write('hello, how are you') * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.write.html */ write( /** Data to send */ data: string | ArrayBuffer ): void /** Close Connection * @supported weapp * @example * ```tsx * const tcp = Vnmf.createTCPSocket() * tcp.close() * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.close.html */ close(): void /** Listen to shut-down events * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onClose.html */ onClose( /** ♪ When one socket Respond function for the event when is completely closed */ callback: TCPSocket.onClose.Callback, ): void /** Disable listening as one. socket When you're completely shut down, the incident will be sent out. * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offClose.html */ offClose( /** ♪ When one socket Respond function for the event when is completely closed */ callback: TCPSocket.onClose.Callback, ): void /** I'll listen to you as a listener. socket Activate the event when connection is successfully created * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onConnect.html */ onConnect( /** ♪ When one socket The echo function triggers the event when connection is successfully created */ callback: TCPSocket.onConnect.Callback, ): void /** Disable listening as one. socket Activate the event when connection is successfully created * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offConnect.html */ offConnect( /** ♪ When one socket The echo function triggers the event when connection is successfully created */ callback: TCPSocket.onConnect.Callback, ): void /** Intercept trigger when an error occurs * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onError.html */ onError( /** Listen to the echo function triggered when an error occurs */ callback: TCPSocket.onError.Callback, ): void /** Disable listening trigger when an error occurs * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offError.html */ offError( /** Listen to the echo function triggered when an error occurs */ callback: TCPSocket.onError.Callback, ): void /** Listen to trigger the event when data is received * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onMessage.html */ onMessage( /** The echo function triggers the event when data is received */ callback: TCPSocket.onMessage.Callback, ): void /** Disable listening and trigger the event when data is received * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offMessage.html */ offMessage( /** The echo function triggers the event when data is received */ callback: TCPSocket.onMessage.Callback, ): void } namespace TCPSocket { namespace connect { interface Option { /** Socket address to connect */ address: string /** Port to connect the Socket */ port: number } } namespace onClose { /** ♪ When one socket Respond function for the event when is completely closed */ type Callback = (...args: unknown[]) => void } namespace onConnect { /** ♪ When one socket The echo function triggers the event when connection is successfully created */ type Callback = (...args: unknown[]) => void } namespace onError { /** Listen to the echo function triggered when an error occurs */ type Callback = (result: CallbackResult) => void interface CallbackResult extends VnmfGeneral.CallbackResult { /** Cannot initialise Evolution's mail component. */ errMsg: string } } namespace onMessage { /** The echo function triggers the event when data is received */ type Callback = (result: CallbackResult) => void interface CallbackResult extends VnmfGeneral.CallbackResult { /** I've got a message. */ message: ArrayBuffer /** Cannot initialise Evolution's mail component. */ remoteInfo: RemoteInfo /** Receiver Address Information */ localInfo: LocalInfo } /** Cannot initialise Evolution's mail component. */ interface RemoteInfo { /** Cannot initialise Evolution's mail component. socket Address */ address: string /** The protocol group to be used,Yes. IPv4 Or... IPv6 */ family: string /** Port number */ port: number /** message Size,Units:Bytes */ size: number } /** Receiver Address Information */ interface LocalInfo { /** He's the one who received message. socket Address */ address: string /** The protocol group to be used,Yes. IPv4 Or... IPv6 */ family: string /** Port number */ port: number } } } interface VnmfStatic { /** Create TCP Socket Example。Read carefully before using[Relevant notes](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 * * **Connection Limits** * * - Allow offline with local area network (LAN) IP Communications * - Allow communication with configured server domain names,Details[Relevant notes](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html) * - Disable connection to the following port number:1024 Below 1099 1433 1521 1719 1720 1723 2049 2375 3128 3306 3389 3659 4045 5060 5061 5432 5984 6379 6000 6566 7001 7002 8000-8100 8443 8888 9200 9300 10051 10080 11211 27017 27018 27019 * - Every 5 Create at most in minutes 20 One. TCPSocket * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/wx.createTCPSocket.html */ createTCPSocket(): TCPSocket } }