# Class InlineWebSocketAdapter2

InlineWebSocketAdapter implements a WebSocket-like interface that connects to a UpgradeWebSocketArgs handler

#### Implements

- UniversalWebSocket

- Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:27

##### Index

### Constructors

constructor

### Properties

CLOSED
CLOSING
CONNECTING
OPEN

### Accessors

binaryType
bufferedAmount
extensions
onclose
onerror
onmessage
onopen
protocol
readyState
url

### Methods

addEventListener
close
dispatchEvent
removeEventListener
send

## Constructors

### constructor

- new InlineWebSocketAdapter2(
  handler: UpgradeWebSocketArgs,
  ): InlineWebSocketAdapter2

  #### Parameters

  - handler: UpgradeWebSocketArgs

  #### Returns InlineWebSocketAdapter2

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:49

## Properties

### `Readonly` CLOSED

CLOSED: 3 = ...

Implementation of UniversalWebSocket.CLOSED

- Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:32

### `Readonly` CLOSING

CLOSING: 2 = ...

Implementation of UniversalWebSocket.CLOSING

- Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:31

### `Readonly` CONNECTING

CONNECTING: 0 = ...

Implementation of UniversalWebSocket.CONNECTING

- Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:29

### `Readonly` OPEN

OPEN: 1 = ...

Implementation of UniversalWebSocket.OPEN

- Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:30

## Accessors

### binaryType

- get binaryType(): "arraybuffer" | "blob"

  #### Returns "arraybuffer" | "blob"

  Implementation of UniversalWebSocket.binaryType

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:75
- set binaryType(value: "arraybuffer" | "blob"): void

  #### Parameters

  - value: "arraybuffer" | "blob"

  #### Returns void

  Implementation of UniversalWebSocket.binaryType

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:79

### bufferedAmount

- get bufferedAmount(): number

  #### Returns number

  Implementation of UniversalWebSocket.bufferedAmount

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:83

### extensions

- get extensions(): string

  #### Returns string

  Implementation of UniversalWebSocket.extensions

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:87

### onclose

- get onclose(): ((event: RivetCloseEvent) => void) | null

  #### Returns ((event: RivetCloseEvent) => void) | null

  Implementation of UniversalWebSocket.onclose

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:452
- set onclose(handler: ((event: RivetCloseEvent) => void) | null): void

  #### Parameters

  - handler: ((event: RivetCloseEvent) => void) | null

  #### Returns void

  Implementation of UniversalWebSocket.onclose

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:455

### onerror

- get onerror(): ((event: RivetEvent) => void) | null

  #### Returns ((event: RivetEvent) => void) | null

  Implementation of UniversalWebSocket.onerror

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:459
- set onerror(handler: ((event: RivetEvent) => void) | null): void

  #### Parameters

  - handler: ((event: RivetEvent) => void) | null

  #### Returns void

  Implementation of UniversalWebSocket.onerror

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:462

### onmessage

- get onmessage(): ((event: RivetMessageEvent) => void) | null

  #### Returns ((event: RivetMessageEvent) => void) | null

  Implementation of UniversalWebSocket.onmessage

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:466
- set onmessage(handler: ((event: RivetMessageEvent) => void) | null): void

  #### Parameters

  - handler: ((event: RivetMessageEvent) => void) | null

  #### Returns void

  Implementation of UniversalWebSocket.onmessage

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:469

### onopen

- get onopen(): ((event: RivetEvent) => void) | null

  #### Returns ((event: RivetEvent) => void) | null

  Implementation of UniversalWebSocket.onopen

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:445
- set onopen(handler: ((event: RivetEvent) => void) | null): void

  #### Parameters

  - handler: ((event: RivetEvent) => void) | null

  #### Returns void

  Implementation of UniversalWebSocket.onopen

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:448

### protocol

- get protocol(): string

  #### Returns string

  Implementation of UniversalWebSocket.protocol

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:91

### readyState

- get readyState(): 0 | 1 | 2 | 3

  #### Returns 0 | 1 | 2 | 3

  Implementation of UniversalWebSocket.readyState

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:71

### url

- get url(): string

  #### Returns string

  Implementation of UniversalWebSocket.url

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:95

## Methods

### addEventListener

- addEventListener(type: string, listener: (ev: any) => void): void

  #### Parameters

  - type: string
  - listener: (ev: any) => void

  #### Returns void

  Implementation of UniversalWebSocket.addEventListener

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:282

### close

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

  Closes the connection

  #### Parameters

  - code: number = 1000
  - reason: string = ""

  #### Returns void

  Implementation of UniversalWebSocket.close

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:121

### dispatchEvent

- dispatchEvent(event: RivetEvent): boolean

  #### Parameters

  - event: RivetEvent

  #### Returns boolean

  Implementation of UniversalWebSocket.dispatchEvent

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:378

### removeEventListener

- removeEventListener(type: string, listener: (ev: any) => void): void

  #### Parameters

  - type: string
  - listener: (ev: any) => void

  #### Returns void

  Implementation of UniversalWebSocket.removeEventListener

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:292

### send

- send(
  data: string | ArrayBufferLike | Blob | ArrayBufferView<ArrayBufferLike>,
  ): void

  #### Parameters

  - data: string | ArrayBufferLike | Blob | ArrayBufferView<ArrayBufferLike>

  #### Returns void

  Implementation of UniversalWebSocket.send

  - Defined in rivetkit-typescript/packages/rivetkit/src/common/inline-websocket-adapter2.ts:99