UNPKG

@iostls/react-native-tcp-socket

Version:

React Native TCP socket API for Android & iOS with SSL/TLS support.TLS-fixed fork of react-native-tcp-socket with iOS mutual auth support

48 lines (47 loc) 1.64 kB
/** * @typedef {object} TLSServerOptions * @property {any} keystore * * @extends {Server} */ export default class TLSServer extends Server { /** * @param {(socket: TLSSocket) => void} [secureConnectionListener] Automatically set as a listener for the `'secureConnection'` event. */ constructor(secureConnectionListener?: (socket: TLSSocket) => void); /** * @param {TLSServerOptions} options TLS server options */ setSecureContext(options: TLSServerOptions): void; /** @private */ private _options; /** * Start a server listening for connections. * * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. * The last parameter `callback` will be added as a listener for the `'listening'` event. * * The `server.listen()` method can be called again if and only if there was an error during the first * `server.listen()` call or `server.close()` has been called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` * error will be thrown. * * @param {{ port: number; host: string; reuseAddress?: boolean}} options * @param {() => void} [callback] * @override */ override listen(options: { port: number; host: string; reuseAddress?: boolean; }, callback?: () => void): Server; /** * @private */ private _registerTLSEvents; _secureConnectionListener: import("react-native").EmitterSubscription | undefined; } export type TLSServerOptions = { keystore: any; }; import Server from './Server'; import TLSSocket from './TLSSocket';