Class WebSocketClientRegistry
java.lang.Object
org.mockserver.closurecallback.websocketregistry.WebSocketClientRegistry
- Author:
- jamesdbloom
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface for stream-frame breakpoint decision replies received over the callback WebSocket. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHeader name carrying the matched breakpoint id so the client can route each pushed paused item to the handler of the SPECIFIC breakpoint that matched.static final StringHeader name carrying the epoch-millis timestamp of when MockServer first received the request.static final Stringstatic final io.netty.util.AttributeKey<WebSocketClientRegistry>Channel attribute key for the per-serverWebSocketClientRegistry. -
Constructor Summary
ConstructorsConstructorDescriptionWebSocketClientRegistry(Configuration configuration, MockServerLogger mockServerLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidreceivedTextWebSocketFrame(io.netty.handler.codec.http.websocketx.TextWebSocketFrame textWebSocketFrame) voidregisterClient(String clientId, io.netty.channel.ChannelHandlerContext ctx) voidregisterForwardCallbackHandler(String webSocketCorrelationId, WebSocketRequestCallback expectationForwardCallback) voidregisterResponseCallbackHandler(String webSocketCorrelationId, WebSocketResponseCallback expectationResponseCallback) voidregisterStreamFrameCallbackHandler(String correlationId, WebSocketClientRegistry.StreamFrameDecisionCallback callback) voidreset()booleansendClientMessage(String clientId, HttpRequest httpRequest, HttpResponse httpResponse) booleansendStreamFrameMessage(String clientId, PausedStreamFrameDTO pausedFrameDTO) Send a paused stream frame DTO to the specified client over the callback WebSocket.intsize()voidunregisterClient(String clientId) voidunregisterForwardCallbackHandler(String webSocketCorrelationId) voidunregisterResponseCallbackHandler(String webSocketCorrelationId) voidunregisterStreamFrameCallbackHandler(String correlationId)
-
Field Details
-
WEB_SOCKET_CORRELATION_ID_HEADER_NAME
- See Also:
-
BREAKPOINT_ID_HEADER_NAME
Header name carrying the matched breakpoint id so the client can route each pushed paused item to the handler of the SPECIFIC breakpoint that matched. Set by the server dispatchers on REQUEST/RESPONSE phase messages.- See Also:
-
REQUEST_TIMESTAMP_HEADER_NAME
Header name carrying the epoch-millis timestamp of when MockServer first received the request. All phases (REQUEST, RESPONSE) of the same exchange share the same value, enabling the dashboard to sort exchanges by original request time rather than by WS arrival time.- See Also:
-
WS_REGISTRY_KEY
Channel attribute key for the per-serverWebSocketClientRegistry. Set once on the parent/server channel at pipeline construction; read at hold points in Netty handlers that need the registry but do not haveHttpStatein direct scope.
-
-
Constructor Details
-
WebSocketClientRegistry
-
-
Method Details
-
receivedTextWebSocketFrame
public void receivedTextWebSocketFrame(io.netty.handler.codec.http.websocketx.TextWebSocketFrame textWebSocketFrame) -
size
public int size() -
registerClient
-
unregisterClient
-
registerResponseCallbackHandler
public void registerResponseCallbackHandler(String webSocketCorrelationId, WebSocketResponseCallback expectationResponseCallback) -
unregisterResponseCallbackHandler
-
registerForwardCallbackHandler
public void registerForwardCallbackHandler(String webSocketCorrelationId, WebSocketRequestCallback expectationForwardCallback) -
unregisterForwardCallbackHandler
-
registerStreamFrameCallbackHandler
public void registerStreamFrameCallbackHandler(String correlationId, WebSocketClientRegistry.StreamFrameDecisionCallback callback) -
unregisterStreamFrameCallbackHandler
-
sendStreamFrameMessage
Send a paused stream frame DTO to the specified client over the callback WebSocket.- Parameters:
clientId- the target clientpausedFrameDTO- the paused frame to send- Returns:
- true if the client was found and the message was sent
-
sendClientMessage
public boolean sendClientMessage(String clientId, HttpRequest httpRequest, HttpResponse httpResponse) -
reset
public void reset()
-