Top Description Methods
io.vertx.core.http

public Interface WebSocketFrame

Known Direct Subinterfaces
io.vertx.core.http.impl.ws.WebSocketFrameInternal
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.CacheReturn, .VertxGen, io.vertx.core.buffer.Buffer, io.vertx.core.http.impl.ws.WebSocketFrameImpl

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.

Authors
The Netty Project, Trustin Lee, Tim Fox
Version
$Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $

Method Summary

Modifier and TypeMethod and Description
public Buffer

Returns:

the data of the frame
binaryData
()
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

public static WebSocketFrame

Returns:

the frame
binaryFrame
(Buffer
the data for the frame
data
,
boolean
true if it's the final frame in the WebSocket message
isFinal
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a binary WebSocket frame.

public String

Returns:

string explaining close reason. Only use this for close frames
closeReason
()

public short

Returns:

status code of close frame. Only use this for close frames
closeStatusCode
()

public static WebSocketFrame

Returns:

the frame
continuationFrame
(Buffer
the data for the frame
data
,
boolean
true if it's the final frame in the WebSocket message
isFinal
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a continuation frame

public boolean

Returns:

whether the frame is a WebSocketFrameType#BINARY frame
isBinary
()

public boolean

Returns:

whether the frame is a WebSocketFrameType#CLOSE frame
isClose
()

public boolean

Returns:

whether the frame is a WebSocketFrameType#CONTINUATION frame
isContinuation
()

public boolean

Returns:

true if this is the final frame.
isFinal
()

public boolean

Returns:

whether the frame is a WebSocketFrameType#PING frame
isPing
()

public boolean

Returns:

whether the frame is a WebSocketFrameType#TEXT frame
isText
()

public static WebSocketFrame

Returns:

the frame
pingFrame
(Buffer
the bytes for the frame, may be at most 125 bytes
data
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a ping WebSocket frame.

public static WebSocketFrame

Returns:

the frame
pongFrame
(Buffer
the bytes for the frame, may be at most 125 bytes
data
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a pong WebSocket frame.

public String

Returns:

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

public static WebSocketFrame

Returns:

the frame
textFrame
(String
the string for the frame
str
,
boolean
true if it's the final frame in the WebSocket message
isFinal
)

Create a text WebSocket frame.

public WebSocketFrameType

Returns:

the frame type
type
()

Method Detail

binaryDataback to summary
public Buffer binaryData()

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns:Buffer

the data of the frame

Annotations
@CacheReturn
binaryFrameback to summary
public static WebSocketFrame binaryFrame(Buffer data, boolean isFinal)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a binary WebSocket frame.

Parameters
data:Buffer

the data for the frame

isFinal:boolean

true if it's the final frame in the WebSocket message

Returns:WebSocketFrame

the frame

closeReasonback to summary
public String closeReason()
Returns:String

string explaining close reason. Only use this for close frames

closeStatusCodeback to summary
public short closeStatusCode()
Returns:short

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

continuationFrameback to summary
public static WebSocketFrame continuationFrame(Buffer data, boolean isFinal)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a continuation frame

Parameters
data:Buffer

the data for the frame

isFinal:boolean

true if it's the final frame in the WebSocket message

Returns:WebSocketFrame

the frame

isBinaryback to summary
public boolean isBinary()
Returns:boolean

whether the frame is a WebSocketFrameType#BINARY frame

isCloseback to summary
public boolean isClose()
Returns:boolean

whether the frame is a WebSocketFrameType#CLOSE frame

isContinuationback to summary
public boolean isContinuation()
Returns:boolean

whether the frame is a WebSocketFrameType#CONTINUATION frame

isFinalback to summary
public boolean isFinal()
Returns:boolean

true if this is the final frame.

isPingback to summary
public boolean isPing()
Returns:boolean

whether the frame is a WebSocketFrameType#PING frame

isTextback to summary
public boolean isText()
Returns:boolean

whether the frame is a WebSocketFrameType#TEXT frame

pingFrameback to summary
public static WebSocketFrame pingFrame(Buffer data)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a ping WebSocket frame. Will be a final frame. There is no option for non final ping frames.

Parameters
data:Buffer

the bytes for the frame, may be at most 125 bytes

Returns:WebSocketFrame

the frame

pongFrameback to summary
public static WebSocketFrame pongFrame(Buffer data)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a pong WebSocket frame. Will be a final frame. There is no option for non final pong frames.

Parameters
data:Buffer

the bytes for the frame, may be at most 125 bytes

Returns:WebSocketFrame

the frame

textDataback to summary
public String textData()
Returns:String

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

Annotations
@CacheReturn
textFrameback to summary
public static WebSocketFrame textFrame(String str, boolean isFinal)

Create a text WebSocket frame.

Parameters
str:String

the string for the frame

isFinal:boolean

true if it's the final frame in the WebSocket message

Returns:WebSocketFrame

the frame

typeback to summary
public WebSocketFrameType type()
Returns:WebSocketFrameType

the frame type