@lidoravitan/capacitor-web-socket-server
v1.0.0
Published
capacitor websocket server plugin
Readme
@lidor/capacitor-web-socket-server
capacitor websocket server plugin
Install
npm install @lidor/capacitor-web-socket-server
npx cap syncAPI
connect(...)
connect(options: ConnectOptions) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------------- |
| options | ConnectOptions |
disconnect()
disconnect() => Promise<void>send(...)
send(options: SendOptions) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------- |
| options | SendOptions |
removeListeners()
removeListeners() => Promise<void>Interfaces
ConnectOptions
| Prop | Type |
| ---------- | ------------------- |
| port | number |
SendOptions
| Prop | Type |
| -------------- | ------------------- |
| clientId | string |
| message | string |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
Type Aliases
AddListenerOverloads
{ (eventName: WebSocketServerEvent.SERVER_START, cb: () => void): T; (eventName: WebSocketServerEvent.SERVER_STOP, cb: () => void): T; (eventName: WebSocketServerEvent.CLIENT_CONNECT, cb: (data: { clientId: string }) => void): T; (eventName: WebSocketServerEvent.CLIENT_DISCONNECT, cb: (data: { clientId: string }) => void): T; (eventName: WebSocketServerEvent.MESSAGE, cb: (data: { clientId: string; message: string }) => void): T; (eventName: WebSocketServerEvent.ERROR, cb: (data: { error: string }) => void): T; }
Enums
WebSocketServerEvent
| Members | Value |
| ----------------------- | ------------------------------- |
| SERVER_START | 'serverStart' |
| SERVER_STOP | 'serverStop' |
| CLIENT_CONNECT | 'clientConnect' |
| CLIENT_DISCONNECT | 'clientDisconnect' |
| MESSAGE | 'message' |
| ERROR | 'error' |
