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 GraphQlWebSocketMessageCreate a"complete"server message.static GraphQlWebSocketMessageconnectionAck(Object payload) Create a"connection_ack"server message.static GraphQlWebSocketMessageconnectionInit(Object payload) Create a"connection_init"client message.booleanstatic GraphQlWebSocketMessageerror(String id, List<GraphQLError> errors) Create an"error"server message.getId()Return the request id that is applicable to messages associated with a request, ornullfor connection level messages.<P> PReturn the payload.getType()Return the message type value as it should appear on the wire.inthashCode()static GraphQlWebSocketMessageCreate a"next"server message.static GraphQlWebSocketMessageCreate a"ping"client or server message.static GraphQlWebSocketMessageCreate a"pong"client or server message.Return the message type as an emum.voidvoidsetPayload(Object payload) voidstatic GraphQlWebSocketMessagesubscribe(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, ornullfor 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 aMaporListfor 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
-