Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@isvend/capacitor-udp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isvend/capacitor-udp

UDP plugin for capacitor

  • 5.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

capacitor-udp

UDP plugin for capacitor

Install

npm install @isvend/capacitor-udp
npx cap sync

API

UDP socket plugin for Capacitor.

Only available on Android and iOS.

create(...)

create(options?: CreateOptions | undefined) => Promise<CreateResult>

Create a socket for udp, and you can create more than one differentiated by the socket id.

Only available on Android and iOS.

ParamType
optionsCreateOptions

Returns: Promise<CreateResult>

Since: 5.0.0


update(...)

update(options: UpdateOptions) => Promise<void>

Update the socket info including socket name and buffer size.

Only available on Android and iOS.

ParamType
optionsUpdateOptions

Since: 5.0.0


bind(...)

bind(options: BindOptions) => Promise<void>

You need to bind a socket before sending and receiving data.

Only available on Android and iOS.

ParamType
optionsBindOptions

Since: 5.0.0


send(...)

send(options: SendOptions) => Promise<void>

Send udp data

Only available on Android and iOS.

ParamType
optionsSendOptions

Since: 5.0.0


close(...)

close(options: CloseOptions) => Promise<void>

Close one socket

Only available on Android and iOS.

ParamType
optionsCloseOptions

Since: 5.0.0


closeAllSockets()

closeAllSockets() => Promise<void>

Close All Sockets

Only available on Android and iOS.

Since: 5.0.0


setBroadcast(...)

setBroadcast(options: SetBroadcastOptions) => Promise<void>

After enabling broadcasting, you can send data with target address 255.255.255.255.

Only available on Android and iOS.

ParamType
optionsSetBroadcastOptions

Since: 5.0.0


setPaused(...)

setPaused(options: SetPausedOptions) => Promise<void>

Pause receiving data.

Only available on Android and iOS.

ParamType
optionsSetPausedOptions

Since: 5.0.0


getInfo(...)

getInfo(options: InfoOptions) => Promise<InfoResult>

Get Socket information

Only available on Android and iOS.

ParamType
optionsInfoOptions

Returns: Promise<InfoResult>

Since: 5.0.0


getSockets()

getSockets() => Promise<GetSocketsResult>

Obtain all the sockets available.

Only available on Android and iOS.

Returns: Promise<GetSocketsResult>

Since: 5.0.0


joinGroup(...)

joinGroup(options: JoinGroupOptions) => Promise<void>

Join a particular group address. For IPv4, it's like "238.12.12.12". For IPv6, it's like "ff02::08".

Only available on Android and iOS.

ParamType
optionsJoinGroupOptions

Since: 5.0.0


leaveGroup(...)

leaveGroup(options: LeaveGroupOptions) => Promise<void>

Leave a particular group address. For IPv4, it's like "238.12.12.12". For IPv6, it's like "ff02::08".

Only available on Android and iOS.

ParamType
optionsLeaveGroupOptions

Since: 5.0.0


getJoinedGroups()

getJoinedGroups() => Promise<GetJoinedGroupsResult>

Get joined groups

Only available on Android and iOS.

Returns: Promise<GetJoinedGroupsResult>

Since: 5.0.0


setMulticastTimeToLive(...)

setMulticastTimeToLive(options: SetMulticastTimeToLiveOptions) => Promise<void>

Set the time to live (TTL) for multicast packets

Only available on Android and iOS.

ParamType
optionsSetMulticastTimeToLiveOptions

Since: 5.0.0


setMulticastLoopbackMode(...)

setMulticastLoopbackMode(options: SetMulticastLoopbackModeOptions) => Promise<void>

Set whether to enable multicast loopback mode

Only available on Android and iOS.

ParamType
optionsSetMulticastLoopbackModeOptions

Since: 5.0.0


addListener('receive', ...)

addListener(eventName: 'receive', listenerFunc: (event: ReceiveEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listening for data reception events

Only available on Android and iOS.

ParamType
eventName'receive'
listenerFunc(event: ReceiveEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 5.0.0


addListener('receiveError', ...)

addListener(eventName: 'receiveError', listenerFunc: (event: ReceiveEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Listening for data reception exception events

Only available on Android and iOS.

ParamType
eventName'receiveError'
listenerFunc(event: ReceiveEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 5.0.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all native listeners for this plugin

Only available on Android and iOS.

Since: 5.0.0


Interfaces

CreateResult

Result of creating a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
ipv4stringipv4 address
ipv6stringipv6 address
CreateOptions

Parameters for creating a UDP socket

PropType
properties{ name?: string; bufferSize?: number; }
UpdateOptions

Parameters for updating a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
properties{ name?: string; bufferSize?: number; }
BindOptions

Parameters for binding a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
addressstringThe address to bind to. If not specified, the socket will be bound to the wildcard address.
portnumberThe port to bind to.
SendOptions

Parameters for sending data

PropTypeDescription
socketIdnumberThe id of the socket
addressstringThe address of the remote host.
portnumberThe port of the remote host.
bufferstringThe data to send.
CloseOptions

Parameters for closing a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
SetBroadcastOptions

Parameters for settings broadcast mode

PropTypeDescription
socketIdnumberThe id of the socket
enabledbooleanWhether to enable broadcast mode.
SetPausedOptions

Parameters for binding a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
pausedbooleanWhether to pause receiving data
InfoResult

Result of getting information about a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
namestring | nullThe name of the socket, which can be used to distinguish between multiple sockets.
bufferSizenumberThe size of the buffer used to receive data.
pausedbooleanWhether data reception has been suspended。
localAddressstringThe address to which the socket is bound.
localPortnumberThe port to which the socket is bound.
InfoOptions

Parameters for getting information about a UDP socket

PropTypeDescription
socketIdnumberThe id of the socket
GetSocketsResult

Parameters for getting information about all UDP sockets

PropTypeDescription
socketsInfoResult[]The list of UDP sockets
JoinGroupOptions

Parameters for joining a multicast group

PropTypeDescription
socketIdnumberThe id of the socket
addressstringThe address of the multicast group to join. For IPv4, it's like "238.12.12.12". For IPv6, it's like "ff02::08".
LeaveGroupOptions

Parameters for leaving a multicast group

PropTypeDescription
socketIdnumberThe id of the socket
addressstringThe address of the multicast group to leave. For IPv4, it's like "238.12.12.12". For IPv6, it's like "ff02::08".
GetJoinedGroupsResult

Parameters for getting joined multicast groups

PropTypeDescription
groups[string]The list of multicast group addresses
SetMulticastTimeToLiveOptions

Parameters for setting multicast time to live

PropTypeDescription
socketIdnumberThe id of the socket
ttlnumberThe time to live value.
SetMulticastLoopbackModeOptions

Parameters for setting multicast loopback mode

PropTypeDescription
socketIdnumberThe id of the socket
enabledbooleanWhether to enable multicast loopback mode.
PluginListenerHandle
PropType
remove() => Promise<void>
ReceiveEvent

Result of receiving data

PropTypeDescription
socketIdnumberThe id of the socket
bufferstringThe data received.
remoteAddressstringThe address of the remote host.
remotePortnumberThe port of the remote host.
errorstringError message

Keywords

FAQs

Package last updated on 26 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc