Class GraphQlWebSocketMessage
java.lang.Object
org.springframework.graphql.server.support.GraphQlWebSocketMessage
Represents a GraphQL over WebSocket protocol message.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQlWebSocketMessage
Create a"complete"
server message.static GraphQlWebSocketMessage
connectionAck
(Object payload) Create a"connection_ack"
server message.static GraphQlWebSocketMessage
connectionInit
(Object payload) Create a"connection_init"
client message.boolean
static GraphQlWebSocketMessage
error
(String id, List<GraphQLError> errors) Create an"error"
server message.getId()
Return the request id that is applicable to messages associated with a request, ornull
for connection level messages.<P> P
Return the payload.getType()
Return the message type value as it should appear on the wire.int
hashCode()
static GraphQlWebSocketMessage
Create a"next"
server message.static GraphQlWebSocketMessage
Create a"ping"
client or server message.static GraphQlWebSocketMessage
Create a"pong"
client or server message.Return the message type as an emum.void
void
setPayload
(Object payload) void
static GraphQlWebSocketMessage
subscribe
(String id, GraphQlRequest request) Create a"subscribe"
client message.toString()
-
Method Details
-
getId
Return the request id that is applicable to messages associated with a request, ornull
for connection level messages. -
getType
Return the message type value as it should appear on the wire. -
resolvedType
Return the message type as an emum. -
getPayload
public <P> P getPayload()Return the payload. For a deserialized message, this is typically aMap
orList
for an"error"
message.- Type Parameters:
P
- teh payload type
-
setId
-
setType
-
setPayload
-
equals
-
hashCode
public int hashCode() -
toString
-
connectionInit
Create a"connection_init"
client message.- Parameters:
payload
- an optional payload
-
connectionAck
Create a"connection_ack"
server message.- Parameters:
payload
- an optional payload
-
subscribe
Create a"subscribe"
client message.- Parameters:
id
- unique request idrequest
- the request to add as the message payload
-
next
Create a"next"
server message.- Parameters:
id
- unique request idresponseMap
- the response map
-
error
Create an"error"
server message.- Parameters:
id
- unique request iderrors
- the error to add as the message payload
-
complete
Create a"complete"
server message.- Parameters:
id
- unique request id
-
ping
Create a"ping"
client or server message.- Parameters:
payload
- an optional payload
-
pong
Create a"pong"
client or server message.- Parameters:
payload
- an optional payload
-