Fixing response parse
This commit is contained in:
parent
b3e44f7eee
commit
8968b50f48
1 changed files with 8 additions and 4 deletions
|
@ -51,10 +51,8 @@ public class GetAccountsByAddress extends WebSocketAdapter {
|
|||
System.out.println("<<< "+frame.getPayloadText());
|
||||
String response = frame.getPayloadText();
|
||||
Gson gson = new Gson();
|
||||
|
||||
Type GetAccountByAddressResponse = new TypeToken<WitnessResponse<List<String>>>(){}.getType();
|
||||
WitnessResponse<WitnessResponse<List<String>>> witnessResponse = gson.fromJson(response, GetAccountByAddressResponse);
|
||||
|
||||
Type GetAccountByAddressResponse = new TypeToken<WitnessResponse<List<List<String>>>>(){}.getType();
|
||||
WitnessResponse<WitnessResponse<List<List<String>>>> witnessResponse = gson.fromJson(response, GetAccountByAddressResponse);
|
||||
if (witnessResponse.error != null) {
|
||||
this.mListener.onError(witnessResponse.error);
|
||||
} else {
|
||||
|
@ -63,6 +61,12 @@ public class GetAccountsByAddress extends WebSocketAdapter {
|
|||
websocket.disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFrameSent(WebSocket websocket, WebSocketFrame frame) throws Exception {
|
||||
if(frame.isTextFrame())
|
||||
System.out.println(">>> "+frame.getPayloadText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(WebSocket websocket, WebSocketException cause) throws Exception {
|
||||
mListener.onError(new BaseResponse.Error(cause.getMessage()));
|
||||
|
|
Loading…
Reference in a new issue