# Class: WebSocketFrame

## vertx-js/web_socket_frame~ WebSocketFrame

#### new WebSocketFrame()

A WebSocket frame that represents either text or binary data.

A WebSocket message is composed of one or more WebSocket frames.

If there is a just a single frame in the message then a single text or binary frame should be created with final = true.

If there are more than one frames in the message, then the first frame should be a text or binary frame with final = false, followed by one or more continuation frames. The last continuation frame should have final = true.

Source:
  - vertx-js/web_socket_frame.js, line 37

### Methods

#### binaryData() → {Buffer}

Source:
  - vertx-js/web_socket_frame.js, line 116

##### Returns:

the data of the frame

Type
  Buffer

#### closeReason() → {string}

Source:
  - vertx-js/web_socket_frame.js, line 158

##### Returns:

string explaining close reason. Only use this for close frames

Type
  string

#### closeStatusCode() → {number}

Source:
  - vertx-js/web_socket_frame.js, line 145

##### Returns:

status code of close frame. Only use this for close frames

Type
  number

#### isBinary() → {boolean}

Source:
  - vertx-js/web_socket_frame.js, line 61

##### Returns:

true if it's a binary frame

Type
  boolean

#### isClose() → {boolean}

Source:
  - vertx-js/web_socket_frame.js, line 87

##### Returns:

true if it's close frame

Type
  boolean

#### isContinuation() → {boolean}

Source:
  - vertx-js/web_socket_frame.js, line 74

##### Returns:

true if it's a continuation frame

Type
  boolean

#### isFinal() → {boolean}

Source:
  - vertx-js/web_socket_frame.js, line 132

##### Returns:

true if this is the final frame.

Type
  boolean

#### isText() → {boolean}

Source:
  - vertx-js/web_socket_frame.js, line 48

##### Returns:

true if it's a text frame

Type
  boolean

#### textData() → {string}

Source:
  - vertx-js/web_socket_frame.js, line 100

##### Returns:

the content of this frame as a UTF-8 string and returns the converted string. Only use this for text frames.

Type
  string