Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebServer

Hierarchy

Index

Constructors

constructor

Properties

attributes

attributes: {}

attributes of the server

Type declaration

  • [key: string]: any

canChat

canChat: boolean

Can connections of this server use the chat system?

Optional config

config: ServerConfig

Shorthand for api.config.servers[this.type]

connectionCustomMethods

connectionCustomMethods: {}

Methods described by the server to apply to each connection (like connection.setHeader for web connections)

Type declaration

  • [key: string]: Function

fingerPrinter

fingerPrinter: BrowserFingerprint

logConnections

logConnections: boolean

Should we log every new connection?

logExits

logExits: boolean

Should we log when a connection disconnects/exits?

Optional options

options: {}

Type declaration

  • [key: string]: any

sendWelcomeMessage

sendWelcomeMessage: boolean

Should every new connection of this server type receive the welcome message (defined in locales, actionhero.welcomeMessage)

server

server: any

type

type: string

The name & type of the server.

Optional verbs

verbs: Array<string>

What connection verbs can connections of this type use?

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

buildConnection

  • buildConnection(data: any): Promise<void>
    • Build a the Actionhero.Connection from the raw parts provided by the server.
      this.buildConnection({
      rawConnection: {
      req: req,
      res: res,
      params: {},
      method: method,
      cookies: cookies,
      responseHeaders: responseHeaders,
      responseHttpCode: responseHttpCode,
      parsedURL: parsedURL
      },
      id: fingerprint + '-' + uuid.v4(),
      fingerprint: fingerprint,
      remoteAddress: remoteIP,
      remotePort: remotePort
      })

    Parameters

    • data: any

    Returns Promise<void>

buildRequesterInformation

  • buildRequesterInformation(connection: any): { fingerprint: any; id: any; messageId: any; receivedParams: {}; remoteIP: any }
  • Parameters

    • connection: any

    Returns { fingerprint: any; id: any; messageId: any; receivedParams: {}; remoteIP: any }

    • fingerprint: any
    • id: any
    • messageId: any
    • receivedParams: {}
    • remoteIP: any

callbackHtmlEscape

  • callbackHtmlEscape(str: any): any
  • Parameters

    • str: any

    Returns any

chmodSocket

  • chmodSocket(bindIP: any, port: any): void
  • Parameters

    • bindIP: any
    • port: any

    Returns void

cleanHeaders

  • cleanHeaders(connection: any): void
  • Parameters

    • connection: any

    Returns void

cleanSocket

  • cleanSocket(bindIP: any, port: any): void
  • Parameters

    • bindIP: any
    • port: any

    Returns void

completeResponse

  • completeResponse(data: any): Promise<void>
  • Parameters

    • data: any

    Returns Promise<void>

connections

  • Enumerate the connections for this server type on this server.

    Returns Array<Connection>

defaultAttributes

  • defaultAttributes(): { canChat: boolean; logConnections: boolean; logExits: boolean; sendWelcomeMessage: boolean; type: null; verbs: undefined[] }
  • Returns { canChat: boolean; logConnections: boolean; logExits: boolean; sendWelcomeMessage: boolean; type: null; verbs: undefined[] }

    • canChat: boolean
    • logConnections: boolean
    • logExits: boolean
    • sendWelcomeMessage: boolean
    • type: null
    • verbs: undefined[]

determineRequestParams

  • determineRequestParams(connection: Connection): Promise<any>
  • Parameters

    Returns Promise<any>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

extractHeader

  • extractHeader(connection: Connection, match: string): any
  • Parameters

    Returns any

fillParamsFromWebRequest

  • fillParamsFromWebRequest(connection: any, varsHash: any): void
  • Parameters

    • connection: any
    • varsHash: any

    Returns void

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Optional goodbye

  • An optional message to send to clients when they disconnect

    Parameters

    Returns Promise<void>

handleRequest

  • handleRequest(req: any, res: any): any
  • Parameters

    • req: any
    • res: any

    Returns any

initialize

  • initialize(): Promise<void>
  • Returns Promise<void>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

log

  • log(message: string, severity?: string, data?: any): void
  • Log a message from this server type. A wrapper around log() with a server prefix.

    Parameters

    • message: string
    • Optional severity: string
    • Optional data: any

    Returns void

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

processAction

  • processAction(connection: Connection): Promise<void>
  • When a connection has called an Action command, and all properties are set. Connection should have params.action set at least. on(event: 'actionComplete', cb: (data: object) => void): this;

    Parameters

    Returns Promise<void>

processFile

  • processFile(connection: Connection): Promise<void>
  • When a connection has called an File command, and all properties are set. Connection should have params.file set at least. Will eventually call Actionhero.Server#sendFile.

    Parameters

    Returns Promise<void>

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

respondToOptions

  • Parameters

    Returns void

respondToTrace

  • Parameters

    Returns void

sendFile

  • sendFile(connection: Connection, error: Error, fileStream: any, mime: string, length: number, lastModified: Date): Promise<void>
  • Parameters

    • connection: Connection
    • error: Error
    • fileStream: any
    • mime: string
    • length: number
    • lastModified: Date

    Returns Promise<void>

sendMessage

  • sendMessage(connection: Connection, message: any): Promise<void>

sendWithCompression

  • sendWithCompression(connection: Connection, responseHttpCode: number, headers: Array<object>, stringResponse: string, fileStream?: any, fileLength?: number): void
  • Parameters

    • connection: Connection
    • responseHttpCode: number
    • headers: Array<object>
    • stringResponse: string
    • Optional fileStream: any
    • Optional fileLength: number

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

start

  • start(): Promise<void>
  • Returns Promise<void>

stop

  • stop(): Promise<void>
  • Returns Promise<void>

transformHeaders

  • transformHeaders(headersArray: any): any
  • Parameters

    • headersArray: any

    Returns any

validate

  • validate(): void
  • Returns void

Generated using TypeDoc