class ControlWebsocketHandler {

	public void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
		LoggingService.logDebug(MODULE_NAME, "Send control signals to container on configuration change");
		if (frame instanceof PingWebSocketFrame) {
			ByteBuf buffer = frame.content();
			if (buffer.readableBytes() == 1) {
				Byte opcode = buffer.readByte();
				if (opcode == OPCODE_PING.intValue()) {
					if (WebsocketUtil.hasContextInMap(ctx, WebSocketMap.controlWebsocketMap)) {
						ByteBuf buffer1 = ctx.alloc().buffer();
						buffer1.writeByte(OPCODE_PONG.intValue());
						ctx.channel().write(new PongWebSocketFrame(buffer1));
					}
				}
			} else {
				LoggingService.logDebug(MODULE_NAME, "Opcode not found for sending control signal");
			}

			return;
		}

		if (frame instanceof BinaryWebSocketFrame) {
			ByteBuf buffer2 = frame.content();
			if (buffer2.readableBytes() == 1) {
				Byte opcode = buffer2.readByte();
				if (opcode == OPCODE_ACK.intValue()) {
					WebSocketMap.unackControlSignalsMap.remove(ctx);
					return;
				}
			}
		}

		if (frame instanceof CloseWebSocketFrame) {
			ctx.channel().close();
			WebsocketUtil.removeWebsocketContextFromMap(ctx, WebSocketMap.controlWebsocketMap);
			StatusReporter.setLocalApiStatus().setOpenConfigSocketsCount(WebSocketMap.controlWebsocketMap.size());
		}
	}

}