capacitor-sockets
Sockets
Install
npm install capacitor-sockets
npx cap sync
API
create(...)connect(...)send(...)disconnect(...)close(...)addListener('state', ...)addListener('message', ...)- Interfaces
create(...)
create(options: { id: string; }) => Promise<void>
| Param | Type |
|---|---|
options |
{ id: string; } |
connect(...)
connect(options: { id: string; host: string; port: number; useTLS?: boolean; acceptInvalidCertificates?: boolean; }) => Promise<void>
| Param | Type |
|---|---|
options |
{ id: string; host: string; port: number; useTLS?: boolean; acceptInvalidCertificates?: boolean; } |
send(...)
send(options: { id: string; message: string; }) => Promise<void>
| Param | Type |
|---|---|
options |
{ id: string; message: string; } |
disconnect(...)
disconnect(options: { id: string; }) => Promise<void>
| Param | Type |
|---|---|
options |
{ id: string; } |
close(...)
close(options: { id: string; }) => Promise<void>
| Param | Type |
|---|---|
options |
{ id: string; } |
addListener('state', ...)
addListener(eventName: "state", listenerFunc: (message: { id: string; state: string; }) => void) => Promise<PluginListenerHandle>
| Param | Type |
|---|---|
eventName |
'state' |
listenerFunc |
(message: { id: string; state: string; }) => void |
Returns: Promise<PluginListenerHandle>
addListener('message', ...)
addListener(eventName: "message", listenerFunc: (message: { id: string; message: string; }) => void) => Promise<PluginListenerHandle>
| Param | Type |
|---|---|
eventName |
'message' |
listenerFunc |
(message: { id: string; message: string; }) => void |
Returns: Promise<PluginListenerHandle>
Interfaces
PluginListenerHandle
| Prop | Type |
|---|---|
remove |
() => Promise<void> |
Description
Languages
Java
53.3%
Swift
30%
TypeScript
9.1%
Ruby
3.5%
HTML
2.4%
Other
1.7%