---
title: "`@cubejs-client/ws-transport`"
description: WebSocket transport for Cube client
---

## `WebSocketTransport`

### constructor

>  **new WebSocketTransport**(**__namedParameters**: object): *[WebSocketTransport](#websockettransport)*

### `apiUrl`

> **apiUrl**: *string*

### `hearBeatInterval`

> **hearBeatInterval**: *number*

### `messageCounter`

> **messageCounter**: *number*

### `messageIdToSubscription`

> **messageIdToSubscription**: *Record‹number, [Subscription](#subscription)›*

### `messageQueue`

> **messageQueue**: *[Message](#message)[]*

### `token`

> **token**: *string*

### `ws`

> **ws**: *any*

### `authorization`

### `initSocket`

>  **initSocket**(): *any*

### `request`

>  **request**(**method**: string, **__namedParameters**: object): *object*

### `sendMessage`

> `protected` **sendMessage**(**message**: any): *void*

## `WebSocketTransportResult`

### constructor

>  **new WebSocketTransportResult**(**__namedParameters**: object): *[WebSocketTransportResult](#result)*

### `result`

> **result**: *unknown*

### `status`

> **status**: *unknown*

### `json`

>  **json**(): *Promise‹unknown›*

## Types

### `Message`

Name | Type |
------ | ------ |
messageId | number |
method | string |
params | string |
requestId | any |

### `Subscription`

Name | Type |
------ | ------ |
callback |  (**result**: [WebSocketTransportResult](#result)) => *void* |
message | [Message](#message) |

### `WebSocketTransportOptions`

Name | Type |
------ | ------ |
apiUrl | string |
authorization | string |
hearBeatInterval? | number |
heartBeatInterval? | number |