# Class RWSServer

#### Hierarchy

- Server
  - RWSServer

- Defined in src/services/ServerService.ts:62

#####
Index

### Constructors

constructor

### Properties

corsOptions
options
server_app
srv
tokens
users
cookies
http_server
ws_server

### Methods

configureHTTPServer
configureWSServer
createServerStarter
disconnectClient
getCorsOptions
getOptions
setJWTToken
webServer
createServerInstance
initializeApp
on404
processErrorTemplate

## Constructors

### constructor

- new RWSServer(webServer, expressApp, opts): RWSServer

- #### Parameters

  - ##### webServer: RWSServer

  - ##### expressApp: Express

  - ##### opts: IInitOpts

  #### Returns RWSServer

  Overrides ServerBase.constructor

  - Defined in src/services/ServerService.ts:72

## Properties

### `Private` corsOptions

corsOptions: CorsOptions

- Defined in src/services/ServerService.ts:70

### `Private` options

options: IInitOpts

- Defined in src/services/ServerService.ts:66

### `Private` server_app

server_app: Express

- Defined in src/services/ServerService.ts:65

### `Private` srv

srv: RWSServer

- Defined in src/services/ServerService.ts:67

### `Private` tokens

tokens: UserTokens = {}

- Defined in src/services/ServerService.ts:68

### `Private` users

users: JWTUsers = {}

- Defined in src/services/ServerService.ts:69

### `Static` cookies

cookies: {
getCookie: ((headers, key) => Promise<string>);
getCookies: ((headers) => Promise<CookieType>);
} = ...

#### Type declaration

- ##### getCookie: ((headers, key) => Promise<string>)

  - - (headers, key): Promise<string>

    - #### Parameters

      - ##### headers: AxiosRequestHeaders

      - ##### key: string

      #### Returns Promise<string>

- ##### getCookies: ((headers) => Promise<CookieType>)

  - - (headers): Promise<CookieType>

    - #### Parameters

      - ##### headers: AxiosRequestHeaders

      #### Returns Promise<CookieType>

- Defined in src/services/ServerService.ts:429

### `Static` `Private` http_server

http_server: RWSServerPair

- Defined in src/services/ServerService.ts:63

### `Static` `Private` ws_server

ws_server: RWSServerPair

- Defined in src/services/ServerService.ts:64

## Methods

### configureHTTPServer

- configureHTTPServer<PassedUser>(UserConstructor?): Promise<RWSServer>

- #### Type Parameters

  - #### PassedUser extends IDbUser

  #### Parameters

  - ##### UserConstructor: (new (params) => PassedUser) = null

    - - new (params): PassedUser

      - #### Parameters

        - ##### params: any

        #### Returns PassedUser

  #### Returns Promise<RWSServer>

  - Defined in src/services/ServerService.ts:221

### configureWSServer

- configureWSServer<PassedUser>(UserConstructor?): Promise<RWSServer>

- #### Type Parameters

  - #### PassedUser extends IDbUser

  #### Parameters

  - ##### UserConstructor: (new (params) => PassedUser) = null

    - - new (params): PassedUser

      - #### Parameters

        - ##### params: any

        #### Returns PassedUser

  #### Returns Promise<RWSServer>

  - Defined in src/services/ServerService.ts:315

### createServerStarter

- createServerStarter(port, injected?): RWSServerStarter

- #### Parameters

  - ##### port: number

  - ##### injected: (() => void) = ...

    - - (): void

      - #### Returns void

  #### Returns RWSServerStarter

  - Defined in src/services/ServerService.ts:211

### disconnectClient

- disconnectClient(clientSocket): void

- #### Parameters

  - ##### clientSocket: Socket<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>

  #### Returns void

  - Defined in src/services/ServerService.ts:171

### getCorsOptions

- getCorsOptions(): CorsOptions

- #### Returns CorsOptions

  - Defined in src/services/ServerService.ts:459

### getOptions

- getOptions(): IInitOpts

- #### Returns IInitOpts

  - Defined in src/services/ServerService.ts:454

### setJWTToken

- setJWTToken(socketId, token): void

- #### Parameters

  - ##### socketId: string

  - ##### token: string

  #### Returns void

  - Defined in src/services/ServerService.ts:175

### webServer

- webServer(): RWSServer

- #### Returns RWSServer

  - Defined in src/services/ServerService.ts:183

### `Static` createServerInstance

- createServerInstance(opts): Promise<[RWSServer, Express]>

- #### Parameters

  - ##### opts: IInitOpts

  #### Returns Promise<[RWSServer, Express]>

  - Defined in src/services/ServerService.ts:188

### `Static` initializeApp

- initializeApp<PassedUser>(opts?, UserConstructor?): Promise<ServerControlSet>

- #### Type Parameters

  - #### PassedUser extends IDbUser

  #### Parameters

  - ##### opts: IInitOpts = _DEFAULT_SERVER_OPTS

  - ##### UserConstructor: (new () => PassedUser) = null

    - - new (): PassedUser

      - #### Returns PassedUser

  #### Returns Promise<ServerControlSet>

  - Defined in src/services/ServerService.ts:131

### `Static` on404

- on404(req, res): void

- #### Parameters

  - ##### req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

  - ##### res: Response<any, Record<string, any>>

  #### Returns void

  - Defined in src/services/ServerService.ts:403

### `Static` processErrorTemplate

- processErrorTemplate(error): string

- #### Parameters

  - ##### error: RWSError

  #### Returns string

  - Defined in src/services/ServerService.ts:420

Generated using TypeDoc