Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebServer

Hierarchy

Index

Constructors

constructor

Properties

attributes

attributes: object

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: object

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

Type declaration

  • [key: string]: Function

fingerprinter

fingerprinter: any

Optional goodbye

goodbye: Function

An optional message to send to clients when they disconnect

logConnections

logConnections: boolean

Should we log every new connection?

logExits

logExits: boolean

Should we log when a connection disconnects/exits?

Optional options

options: object

Type declaration

  • [key: string]: any

sendWelcomeMessage

sendWelcomeMessage: boolean

Should every new connection of this server type recieve the wecome message (defiend 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?

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...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): object
  • Parameters

    • connection: any

    Returns object

    • fingerprint: any
    • id: any
    • messageId: any
    • receivedParams: object
    • remoteIP: any

callbackHtmlEscape

  • callbackHtmlEscape(str: any): any

chmodSocket

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

cleanHeaders

  • cleanHeaders(connection: any): void

cleanSocket

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

completeResponse

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

connections

defaultAttributes

  • defaultAttributes(): object

determineRequestParams

  • determineRequestParams(connection: Connection): 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

fillParamsFromWebRequest

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

getMaxListeners

  • getMaxListeners(): number
  • Returns number

handleRequest

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

initialize

  • initialize(): 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: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...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 eventuall 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: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

respondToOptions

respondToTrace

sendFile

  • sendFile(connection: Connection, error: Error, fileStream: any, mime: string, length: number, lastModified: Date): 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>

stop

  • stop(): Promise<void>

transformHeaders

  • transformHeaders(headersArray: any): any

validate

  • validate(): void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc