@bsv/authsocket-client
Version:
Mutually Authenticated Web Sockets Client
31 lines • 1.16 kB
text/typescript
import { Socket } from "socket.io-client";
import { AuthMessage, Transport } from "@bsv/sdk";
//#region src/SocketClientTransport.d.ts
interface SocketClientTransportOptions {
/** Maximum authentication messages that may be processed concurrently per socket. */
maxPendingMessages?: number;
/** Receives contained authentication failures. The hook is never allowed to throw outward. */
onError?: (error: unknown) => void | Promise<void>;
}
declare class SocketClientTransport implements Transport {
private readonly socket;
private onDataCallback?;
private readonly maxPendingMessages;
private readonly onError?;
private pendingMessages;
private failed;
constructor(socket: Socket, options?: SocketClientTransportOptions);
/**
* Send an AuthMessage to the server.
*/
send(message: AuthMessage): Promise<void>;
/**
* Register a callback to handle incoming AuthMessages.
*/
onData(callback: (message: AuthMessage) => Promise<void>): Promise<void>;
private processMessage;
private fail;
}
//#endregion
export { SocketClientTransport, SocketClientTransportOptions };
//# sourceMappingURL=SocketClientTransport.d.cts.map