UNPKG

@push.rocks/smartsocket

Version:

Provides easy and secure websocket communication mechanisms, including server and client implementation, function call routing, connection management, and tagging.

36 lines (35 loc) 1.21 kB
import * as pluginsTyped from './smartsocket.pluginstyped.js'; import { Smartsocket } from './smartsocket.classes.smartsocket.js'; /** * class SocketServer * handles the WebSocket server in standalone mode, or provides hooks for smartserve integration */ export declare class SocketServer { private smartsocket; private httpServer; private wsServer; /** * whether httpServer is standalone (created by us) */ private standaloneServer; constructor(smartSocketInstance: Smartsocket); /** * Starts listening to incoming websocket connections (standalone mode). * If no port is specified, this is a no-op (hooks mode via smartserve). */ start(): Promise<void>; /** * closes the server */ stop(): Promise<void>; /** * Returns WebSocket hooks for integration with smartserve. * Pass these hooks to SmartServe's websocket config. */ getSmartserveWebSocketHooks(): pluginsTyped.ISmartserveWebSocketHooks; /** * Creates a WebSocket-like object from a smartserve peer * This allows our SocketConnection to work with both native WebSocket and smartserve peers */ private createWsLikeFromPeer; }