[]
Represents a collaboration server, provides bidirectional communication, middleware and hooks mechanism.
• new Server(config?)
| Name | Type |
|---|---|
config? |
IServerConfig |
▸ on(hooks): void
Registers multiple hooks to the server in a batch.
| Name | Type | Description |
|---|---|---|
hooks |
IHooks |
The hooks to register. |
void
▸ on<K>(action, hook): void
Registers a single hook for a specific action on the server.
| Name | Type | Description |
|---|---|---|
K |
extends keyof IHookContext |
Type of the action name, extending keyof IHookContext. |
| Name | Type | Description |
|---|---|---|
action |
K |
he name of the action to associate with the hook |
hook |
IHook<IHookContext[K]> |
The hook to register for the specified action. |
void
▸ use(middlewares): void
Registers multiple middlewares to the server in a batch.
| Name | Type | Description |
|---|---|---|
middlewares |
IMiddlewares |
The middlewares to register. |
void
▸ use<K>(action, middleware): void
Registers a single middleware for a specific action on the server.
| Name | Type | Description |
|---|---|---|
K |
extends keyof IMiddlewareContext |
Type of the action name, extending keyof IMiddlewareContext. |
| Name | Type | Description |
|---|---|---|
action |
K |
The name of the action to associate with the middleware. |
middleware |
IMiddleware<IMiddlewareContext[K]> |
The middleware to register for the specified action. |
void
▸ useFeature(feature): void
Register feature to the server.
| Name | Type | Description |
|---|---|---|
feature |
IFeature |
The feature to register. |
void