@morojs/moro / WebSocketAdapter
Interface: WebSocketAdapter
Defined in: src/core/networking/websocket-adapter.ts:56
Abstract WebSocket adapter interface Allows the framework to work with different WebSocket implementations
Methods
close()
close():
Promise<void>
Defined in: src/core/networking/websocket-adapter.ts:75
Close the WebSocket server and all connections
Returns
Promise<void>
createNamespace()
createNamespace(
namespace,options?):WebSocketNamespace
Defined in: src/core/networking/websocket-adapter.ts:65
Create a namespace for organizing WebSocket connections
Parameters
namespace
string
options?
Returns
getAdapterName()
getAdapterName():
string
Defined in: src/core/networking/websocket-adapter.ts:90
Get adapter name/type
Returns
string
getConnectionCount()
getConnectionCount():
number
Defined in: src/core/networking/websocket-adapter.ts:95
Get connection count across all namespaces
Returns
number
getDefaultNamespace()
getDefaultNamespace():
WebSocketNamespace
Defined in: src/core/networking/websocket-adapter.ts:70
Get the default namespace (usually '/')
Returns
initialize()
initialize(
httpServer,options?):Promise<void>
Defined in: src/core/networking/websocket-adapter.ts:60
Initialize the WebSocket server with the given HTTP server
Parameters
httpServer
any
options?
Returns
Promise<void>
setCompression()
setCompression(
enabled,options?):void
Defined in: src/core/networking/websocket-adapter.ts:80
Set compression configuration
Parameters
enabled
boolean
options?
any
Returns
void
setCustomIdGenerator()
setCustomIdGenerator(
generator):void
Defined in: src/core/networking/websocket-adapter.ts:85
Set custom ID generator for connections
Parameters
generator
() => string
Returns
void