|
|
@ -30,6 +30,7 @@ import io.vertx.core.http.RequestOptions; |
|
|
|
import io.vertx.core.http.WebSocket; |
|
|
|
import io.vertx.core.http.WebSocket; |
|
|
|
import io.vertx.core.json.DecodeException; |
|
|
|
import io.vertx.core.json.DecodeException; |
|
|
|
import io.vertx.core.json.Json; |
|
|
|
import io.vertx.core.json.Json; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils; |
|
|
|
|
|
|
|
|
|
|
|
public class WebSocketConnection { |
|
|
|
public class WebSocketConnection { |
|
|
|
|
|
|
|
|
|
|
@ -102,7 +103,11 @@ public class WebSocketConnection { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (final DecodeException e) { |
|
|
|
} catch (final DecodeException e) { |
|
|
|
error(data.toString()); |
|
|
|
error( |
|
|
|
|
|
|
|
"Data: " |
|
|
|
|
|
|
|
+ data.toString() |
|
|
|
|
|
|
|
+ "\nException: " |
|
|
|
|
|
|
|
+ ExceptionUtils.getStackTrace(e)); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -115,24 +120,24 @@ public class WebSocketConnection { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void resetLatestResult() { |
|
|
|
private void resetLatestResult() { |
|
|
|
this.receivedResponse = false; |
|
|
|
|
|
|
|
this.error = null; |
|
|
|
this.error = null; |
|
|
|
this.latestEvent = null; |
|
|
|
this.latestEvent = null; |
|
|
|
|
|
|
|
this.receivedResponse = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void error(final String response) { |
|
|
|
private void error(final String response) { |
|
|
|
this.receivedResponse = true; |
|
|
|
|
|
|
|
this.error = response; |
|
|
|
this.error = response; |
|
|
|
|
|
|
|
this.receivedResponse = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void success(final JsonRpcSuccessEvent result) { |
|
|
|
private void success(final JsonRpcSuccessEvent result) { |
|
|
|
this.receivedResponse = true; |
|
|
|
|
|
|
|
this.latestEvent = result; |
|
|
|
this.latestEvent = result; |
|
|
|
|
|
|
|
this.receivedResponse = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void success(final SubscriptionEvent result) { |
|
|
|
private void success(final SubscriptionEvent result) { |
|
|
|
this.receivedResponse = true; |
|
|
|
|
|
|
|
this.subscriptionEvents.add(result); |
|
|
|
this.subscriptionEvents.add(result); |
|
|
|
|
|
|
|
this.receivedResponse = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<SubscriptionEvent> getSubscriptionEvents() { |
|
|
|
public List<SubscriptionEvent> getSubscriptionEvents() { |
|
|
|