Package org.mockserver.model
Class HttpWebSocketResponse
java.lang.Object
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mockserver.model.Action
Action.Direction, Action.Type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetType()inthashCode()static HttpWebSocketResponsewithCloseConnection(Boolean closeConnection) Set a GraphQL subscription filter for the graphql-transport-ws protocol.withMatcher(WebSocketMessageMatcher matcher) withMatchers(List<WebSocketMessageMatcher> matchers) withMatchers(WebSocketMessageMatcher... matchers) withMessage(WebSocketMessage message) withMessages(List<WebSocketMessage> messages) withMessages(WebSocketMessage... messages) withSubprotocol(String subprotocol) withTemplateType(HttpTemplate.TemplateType templateType) Opt-in response templating: when set (toHttpTemplate.TemplateType.VELOCITY,HttpTemplate.TemplateType.MUSTACHEorHttpTemplate.TemplateType.JAVASCRIPT), each configured textWebSocketMessageis rendered as a response template against the triggering request (so$!request.body,$jsonPath(...), the built-in helpers, thefakerhelper and thescenariohelper are all available) rather than sent verbatim.Methods inherited from class org.mockserver.model.Action
getDelay, getExpectationId, isPrimary, setExpectationId, withDelay, withDelay, withPrimaryMethods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
HttpWebSocketResponse
public HttpWebSocketResponse()
-
-
Method Details
-
webSocketResponse
-
withSubprotocol
-
getSubprotocol
-
withMessages
-
withMessages
-
withMessage
-
getMessages
-
withMatchers
-
withMatchers
-
withMatcher
-
getMatchers
-
withCloseConnection
-
getCloseConnection
-
withGraphqlSubscriptionFilter
Set a GraphQL subscription filter for the graphql-transport-ws protocol. When the negotiated subprotocol isgraphql-transport-wsorgraphql-ws, incomingsubscribemessages will have their query matched against this filter. On match, the configuredmessagesare pushed asnextpayloads.- Parameters:
filter- the GraphQL body to match subscription queries against- Returns:
- this instance for fluent chaining
-
getGraphqlSubscriptionFilter
-
withTemplateType
Opt-in response templating: when set (toHttpTemplate.TemplateType.VELOCITY,HttpTemplate.TemplateType.MUSTACHEorHttpTemplate.TemplateType.JAVASCRIPT), each configured textWebSocketMessageis rendered as a response template against the triggering request (so$!request.body,$jsonPath(...), the built-in helpers, thefakerhelper and thescenariohelper are all available) rather than sent verbatim. The template is rendered once per message, immediately before the frame is written. Binary messages are never templated.When
null(the default) every message is sent byte-for-byte unchanged, exactly as before this field existed. -
getTemplateType
-
getType
- Specified by:
getTypein classAction<HttpWebSocketResponse>
-
equals
- Overrides:
equalsin classAction<HttpWebSocketResponse>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAction<HttpWebSocketResponse>
-