use of com.github.jnidzwetzki.bitfinex.v2.callback.command.CommandCallbackHandler in project bitfinex-v2-wss-api-java by jnidzwetzki.
the class BitfinexApiBroker method handleCommandCallback.
/**
* Handle a command callback
*/
private void handleCommandCallback(final String message) {
logger.debug("Got {}", message);
// JSON callback
final JSONTokener tokener = new JSONTokener(message);
final JSONObject jsonObject = new JSONObject(tokener);
final String eventType = jsonObject.getString("event");
if (!commandCallbacks.containsKey(eventType)) {
logger.error("Unknown event: {}", message);
} else {
try {
final CommandCallbackHandler callback = commandCallbacks.get(eventType);
callback.handleChannelData(this, jsonObject);
} catch (APIException e) {
logger.error("Got an exception while handling callback");
}
}
}
Aggregations