@morojs/moro / WSAdapter
Class: WSAdapter
Defined in: src/core/networking/adapters/ws-adapter.ts:19
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:128
Parameters
id
string
connection
WSConnectionWrapper
Returns
void
close()
close():
Promise<void>
Defined in: src/core/networking/adapters/ws-adapter.ts:89
Close the WebSocket server and all connections
Returns
Promise<void>
Implementation of
createNamespace()
createNamespace(
namespace):WebSocketNamespace
Defined in: src/core/networking/adapters/ws-adapter.ts:77
Create a namespace for organizing WebSocket connections
Parameters
namespace
string
Returns
Implementation of
WebSocketAdapter.createNamespace
generateId()
generateId():
string
Defined in: src/core/networking/adapters/ws-adapter.ts:121
Returns
string
getAdapterName()
getAdapterName():
string
Defined in: src/core/networking/adapters/ws-adapter.ts:113
Get adapter name/type
Returns
string
Implementation of
WebSocketAdapter.getAdapterName
getAllConnections()
getAllConnections():
Map<string,WSConnectionWrapper>
Defined in: src/core/networking/adapters/ws-adapter.ts:136
Returns
Map<string, WSConnectionWrapper>
getConnectionCount()
getConnectionCount():
number
Defined in: src/core/networking/adapters/ws-adapter.ts:117
Get connection count across all namespaces
Returns
number
Implementation of
WebSocketAdapter.getConnectionCount
getDefaultNamespace()
getDefaultNamespace():
WebSocketNamespace
Defined in: src/core/networking/adapters/ws-adapter.ts:85
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:27
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:132
Parameters
id
string
Returns
void
setCompression()
setCompression(
enabled,_options):void
Defined in: src/core/networking/adapters/ws-adapter.ts:101
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:109
Set custom ID generator for connections
Parameters
generator
() => string
Returns
void