@morojs/moro / WSAdapter
Class: WSAdapter
Defined in: src/core/networking/adapters/ws-adapter.ts:20
Native WebSocket adapter using the 'ws' library Provides a lightweight, standards-compliant WebSocket implementation
Implements
Constructors
Constructor
new WSAdapter():
WSAdapter
Returns
WSAdapter
Methods
addConnection()
addConnection(
id,connection):void
Defined in: src/core/networking/adapters/ws-adapter.ts:295
Parameters
id
string
connection
WSConnectionWrapper
Returns
void
close()
close():
Promise<void>
Defined in: src/core/networking/adapters/ws-adapter.ts:238
Close the WebSocket server and all connections
Returns
Promise<void>
Implementation of
createNamespace()
createNamespace(
namespace,options?):WebSocketNamespace
Defined in: src/core/networking/adapters/ws-adapter.ts:223
Create a namespace for organizing WebSocket connections
Parameters
namespace
string
options?
Returns
Implementation of
WebSocketAdapter.createNamespace
generateId()
generateId():
string
Defined in: src/core/networking/adapters/ws-adapter.ts:288
Returns
string
getAdapterName()
getAdapterName():
string
Defined in: src/core/networking/adapters/ws-adapter.ts:280
Get adapter name/type
Returns
string
Implementation of
WebSocketAdapter.getAdapterName
getAllConnections()
getAllConnections():
Map<string,WSConnectionWrapper>
Defined in: src/core/networking/adapters/ws-adapter.ts:303
Returns
Map<string, WSConnectionWrapper>
getConnectionCount()
getConnectionCount():
number
Defined in: src/core/networking/adapters/ws-adapter.ts:284
Get connection count across all namespaces
Returns
number
Implementation of
WebSocketAdapter.getConnectionCount
getDefaultNamespace()
getDefaultNamespace():
WebSocketNamespace
Defined in: src/core/networking/adapters/ws-adapter.ts:234
Get the default namespace (usually '/')
Returns
Implementation of
WebSocketAdapter.getDefaultNamespace
initialize()
initialize(
httpServer,options?):Promise<void>
Defined in: src/core/networking/adapters/ws-adapter.ts:33
Initialize the WebSocket server with the given HTTP server
Parameters
httpServer
any
options?
Returns
Promise<void>
Implementation of
removeConnection()
removeConnection(
id):void
Defined in: src/core/networking/adapters/ws-adapter.ts:299
Parameters
id
string
Returns
void
setCompression()
setCompression(
enabled,_options?):void
Defined in: src/core/networking/adapters/ws-adapter.ts:268
Set compression configuration
Parameters
enabled
boolean
_options?
any = {}
Returns
void
Implementation of
WebSocketAdapter.setCompression
setCustomIdGenerator()
setCustomIdGenerator(
generator):void
Defined in: src/core/networking/adapters/ws-adapter.ts:276
Set custom ID generator for connections
Parameters
generator
() => string
Returns
void