public interface WebSocketFrame
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.
Modifier and Type | Method and Description |
---|---|
Buffer |
binaryData() |
static WebSocketFrame |
binaryFrame(Buffer data,
boolean isFinal)
Create a binary WebSocket frame.
|
String |
closeReason() |
short |
closeStatusCode() |
static WebSocketFrame |
continuationFrame(Buffer data,
boolean isFinal)
Create a continuation frame
|
boolean |
isBinary() |
boolean |
isClose() |
boolean |
isContinuation() |
boolean |
isFinal() |
boolean |
isPing() |
boolean |
isText() |
static WebSocketFrame |
pingFrame(Buffer data)
Create a ping WebSocket frame.
|
static WebSocketFrame |
pongFrame(Buffer data)
Create a pong WebSocket frame.
|
String |
textData() |
static WebSocketFrame |
textFrame(String str,
boolean isFinal)
Create a text WebSocket frame.
|
WebSocketFrameType |
type() |
static WebSocketFrame binaryFrame(Buffer data, boolean isFinal)
data
- the data for the frameisFinal
- true if it's the final frame in the WebSocket messagestatic WebSocketFrame textFrame(String str, boolean isFinal)
str
- the string for the frameisFinal
- true if it's the final frame in the WebSocket messagestatic WebSocketFrame pingFrame(Buffer data)
data
- the bytes for the frame, may be at most 125 bytesstatic WebSocketFrame pongFrame(Buffer data)
data
- the bytes for the frame, may be at most 125 bytesstatic WebSocketFrame continuationFrame(Buffer data, boolean isFinal)
data
- the data for the frameisFinal
- true if it's the final frame in the WebSocket messageWebSocketFrameType type()
boolean isText()
WebSocketFrameType.TEXT
frameboolean isBinary()
WebSocketFrameType.BINARY
frameboolean isContinuation()
WebSocketFrameType.CONTINUATION
frameboolean isClose()
WebSocketFrameType.CLOSE
frameboolean isPing()
WebSocketFrameType.PING
frameString textData()
Buffer binaryData()
boolean isFinal()
short closeStatusCode()
String closeReason()
Copyright © 2022 Eclipse. All rights reserved.