BaseSocketServer
Shared lifecycle and route-composition base for SocketServer and SecureSocketServer. Extend the concrete servers for normal applications; use this type when building infrastructure integrations.
The simple mental model
BaseSocketServer is the engine room beneath both plain and secure socket servers. It coordinates routes and upgrades without deciding how the outer listener was created.
When should I use it?
Use this advanced surface for custom integrations that need Redweb routing on a specially managed Node HTTP or HTTPS server.
Follow the example
This pattern explains the named API. Application classes, credentials, and assets may need to be supplied; use a complete recipe for a runnable starting point.
import { BaseSocketServer } from 'redweb'
// SocketServer and SecureSocketServer inherit:
// addRoute(), handleUpgrade(), beginDrain(), and shutdown().- 1
Your application supplies or prepares the listener.
- 2
BaseSocketServer attaches bounded WebSocket upgrade and route lifecycle behavior.
- 3
Concrete server ownership remains visible, including whether Redweb may listen or close it.
Methods and members
addRoute(RouteClass)
Creates and registers one route class while enforcing unique paths.
beginDrain()
Stops accepting new upgrades across every registered route.
shutdown()
Drains routes and closes owned listeners without closing caller-owned servers.