0.0.4 • Published 7 months ago

cap-tcp-socket-plugin v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

cap-tcp-socket-plugin

A tcp socket plugin for capacitor

Install

npm install cap-tcp-socket-plugin
npx cap sync

API

sendAsync(...)

sendAsync(options: { ipAddress: string; port: number; data: number[]; connectionTimeoutInSec: number; }) => Promise<{ status: ResultStatus; message?: string; data?: number[]; }>

Sends data over TCP to the specified IP address and port.

ParamTypeDescription
options{ ipAddress: string; port: number; data: number[]; connectionTimeoutInSec: number; }- Configuration for the TCP request.

Returns: Promise<{ status: ResultStatus; message?: string; data?: number[]; }>


startReceiving(...)

startReceiving(options: { port: number; }) => Promise<void>
ParamType
options{ port: number; }

stopReceiving()

stopReceiving() => Promise<void>

addListener('receiveData', ...)

addListener(eventName: "receiveData", listener: (data: { status: string; data: number[]; }) => void) => Promise<PluginListenerHandle>

Adds a listener for the 'receiveData' event.

ParamTypeDescription
eventName'receiveData'- The name of the event (in this case, 'receiveData').
listener(data: { status: string; data: number[]; }) => void- The callback function to handle the event.

Returns: Promise<PluginListenerHandle>


getCurrentIPAddress()

getCurrentIPAddress() => Promise<{ ipAddress: string; }>

Retrieves the current IP address of the device.

Returns: Promise<{ ipAddress: string; }>


Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>

Enums

ResultStatus

MembersValue
Unknown0
Success1
FailedToSendData2
NoResponseReceivedWithinTimeout3
FailedToReceiveData4
0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

1 year ago