Module: @socketdb/server
Classes
Interfaces
Functions
SocketDBServer
▸ SocketDBServer<Schema
>(«destructured»?
): SocketDBServerAPI
<Schema
>
Type parameters
Name | Type |
---|---|
Schema | extends Json |
Parameters
Name | Type | Description |
---|---|---|
«destructured» | Object | - |
› keepAliveInterval? | number | Interval in milliseconds between keep alive pings. Default ts 30000 Set to 0 to disable keep alive. |
› plugins? | ServerPlugin <Schema >[] | - |
› socketServer? | SocketServer | - |
› store? | Store | - |
› updateInterval? | number | - |
Returns
SocketDBServerAPI
<Schema
>
Defined in
packages/server/src/lib/server.ts:159
createWebsocketServer
▸ createWebsocketServer(«destructured»?
): DefaultWebsocketServer
Parameters
Name | Type |
---|---|
«destructured» | { generateId? : () => string ; initializeSession? : (params : { req : IncomingMessage }) => SessionContext | Promise <SessionContext > } & CustomizableWSOptions |
Returns
DefaultWebsocketServer
Defined in
packages/server/src/lib/socket-implementation/websocketServer.ts:26
mockSocketServer
▸ mockSocketServer(«destructured»?
): Object
creates a mock socket server for testing
Parameters
Name | Type |
---|---|
«destructured» | Object |
› initializeSession? | () => Record <string , unknown > |
Returns
Object
Name | Type |
---|---|
connectClient | (__namedParameters : { id? : string ; onClose? : () => void ; onSend? : (event : string , data : any ) => void }) => { disconnect : () => void ; notify : (event : string , data : any ) => void } |
socketServer | SocketServer |
Defined in
packages/server/src/lib/socket-implementation/mockServer.ts:6
Type Aliases
ServerPlugin
Ƭ ServerPlugin<Schema
>: Plugin
<ServerHooks
<Schema
>>
Type parameters
Name | Type |
---|---|
Schema | extends RootSchemaDefinition = RootSchemaDefinition |
Defined in
packages/server/src/lib/server.ts:155
SocketDBServerAPI
Ƭ SocketDBServerAPI<Schema
>: SocketDBServerDataAPI
<Schema
> & { getClient
: (id
: string
| (context
: SessionContext
) => boolean
) => Client
| null
; getClients
: (filter?
: (context
: SessionContext
) => boolean
) => Client
[] ; intercept
: <Hook>(hook
: Hook
, callback
: ServerHooks
<Schema
>[Hook
]) => () => void
; listen
: (port?
: number
, callback?
: () => void
) => void
}
Type parameters
Name | Type |
---|---|
Schema | extends RootSchemaDefinition |
Defined in
packages/server/src/lib/server.ts:47