use of org.wso2.carbon.apimgt.gateway.inbound.websocket.request.RequestProcessor in project carbon-apimgt by wso2.
the class InboundWebSocketProcessor method handleRequest.
/**
* This method process websocket request messages (publish messages) and
* hand over the processing to relevant request intercepting processor for authentication, scope validation,
* throttling etc.
*
* @param msg Websocket request message frame
* @param inboundMessageContext InboundMessageContext
* @return InboundProcessorResponseDTO with handshake processing response
*/
public InboundProcessorResponseDTO handleRequest(WebSocketFrame msg, InboundMessageContext inboundMessageContext) {
RequestProcessor requestProcessor;
String msgText = null;
if (APIConstants.GRAPHQL_API.equals(inboundMessageContext.getElectedAPI().getApiType()) && msg instanceof TextWebSocketFrame) {
requestProcessor = new GraphQLRequestProcessor();
msgText = ((TextWebSocketFrame) msg).text();
} else {
requestProcessor = new RequestProcessor();
}
return requestProcessor.handleRequest(msg.content().capacity(), msgText, inboundMessageContext);
}
Aggregations