An adapter to use any kind of websocket and interface it with a browser compatible type of websocket

### Hierarchy

- WebSocketAdapter
  - BrowserWebSocketAdapter

## Index

### Constructors

- constructor

### Properties

- path

### Methods

- close
- onClose
- onError
- onMessage
- onOpen
- send

## Constructors

### constructor

- new WebSocketAdapter(path: string): WebSocketAdapter

- - Defined in src/network/websocket-adapter.ts:9

  #### Parameters

  - ##### path: string

  #### Returns WebSocketAdapter

## Properties

### path

path: string

- Defined in src/network/websocket-adapter.ts:9

## Methods

### Abstract close

- close(code: number, reason?: string): void

- - Defined in src/network/websocket-adapter.ts:49

  Close the websocket connection

  #### Parameters

  - ##### code: number

    The code to use when closing

  - ##### Optional reason: string

  #### Returns void

### Abstract onClose

- onClose(callback: function): void

- - Defined in src/network/websocket-adapter.ts:31

  Event triggered after the websocket has closed

  #### Parameters

  - ##### callback: function

    Function called after the closure

    - - (code: number, reason: string): void

      - #### Parameters

        - ##### code: number

        - ##### reason: string

        #### Returns void

### Abstract onError

- onError(callback: function): void

- - Defined in src/network/websocket-adapter.ts:37

  Event triggered when an error occured

  #### Parameters

  - ##### callback: function

    Function called with the error

    - - (err: Error): void

      - #### Parameters

        - ##### err: Error

        #### Returns void

### Abstract onMessage

- onMessage(callback: function): void

- - Defined in src/network/websocket-adapter.ts:25

  Event triggered after a message is received

  #### Parameters

  - ##### callback: function

    Function called with the message as a data buffer

    - - (data: Buffer): void

      - #### Parameters

        - ##### data: Buffer

        #### Returns void

### Abstract onOpen

- onOpen(callback: function): void

- - Defined in src/network/websocket-adapter.ts:19

  Event triggered after the websocket successfully opened

  #### Parameters

  - ##### callback: function

    Function called after the event

    - - (): void

      - #### Returns void

### Abstract send

- send(bytes: Buffer): void

- - Defined in src/network/websocket-adapter.ts:43

  Send a buffer over the websocket connection

  #### Parameters

  - ##### bytes: Buffer

    The data to send

  #### Returns void

Generated using TypeDoc