grisp / grisp_connect

GRiSP.io client application
Apache License 2.0
1 stars 0 forks source link

First device-api WS with flash feature #2

Closed ziopio closed 1 year ago

ziopio commented 1 year ago

During latest testing I came along this problem, happening after processing the flash

(fish@grisp-board)2> 2023-02-24T10:10:42.189936+00:00 debug: JsonRPC reply: [{result,ok,<<"-576460752303423103">>}]
(fish@grisp-board)2> 2023-02-24T10:10:42.203328+00:00 debug: Received JsonRPC error: {error,-32600,<<"Invalid Request">>,undefined,null}

Grisp manager should receive the <<"ok">> and be fine, but the server replies with an error to my result.

ziopio commented 1 year ago

From the server i see {error, timeout} This probably means that my reply is mistaken for an invalid request.

ziopio commented 1 year ago

After upgrading jsx to 3.1.0 in my local seawater I get the reply correctly

1> grisp_manager_device_api:flash(<<"000000">>).
{ok,<<"ok">>}

But then my client enters a loop of errors exchange with the server, i probably need to fix the protocol.

2> =ERROR REPORT==== 24-Feb-2023::11:58:29.461740 ===
Unexpected response: {error,jsonrpc_error}
ziopio commented 1 year ago

The behaviour client side is correct since i receive <<"[]">> And reply with an error

(fish@grisp-board)2> 2023-02-24T11:11:27.073136+00:00 debug: JsonRPC-text-in: <<"[]">>
(fish@grisp-board)2> 2023-02-24T11:11:27.074411+00:00 error: JsonRPC: {internal_error,invalid_request,null}
(fish@grisp-board)2> 2023-02-24T11:11:27.075562+00:00 debug: JsonRPC reply: [{error,-32600,<<"Invalid request">>,undefined,null}]
ziopio commented 1 year ago

@maehjam Last commit avoids causing a loop. Meanwhile i opened a pull request to fix the bad reply from kraft.

ziopio commented 1 year ago

@maehjam note that i straight up copied the grisp_seawater_jsonrpc from the module we have in dab_lib, so any correction here, could also be made there.