public NettyInteractiveResponse(String type, Map<String, Object> map) throws IOException {
this.type = type;
XContentBuilder responseBuilder = jsonBuilder();
responseBuilder.startObject().field("success", true).field("type", type).field("data", map).endObject();
this.response = new TextWebSocketFrame(responseBuilder.string());
}
public NettyInteractiveResponse(String type, Throwable t) {
this.type = type;
this.response = new TextWebSocketFrame("{\"success\":false,\"type\":\"" + type + "\",\"error\":\"" + t.getMessage() + "\"");