threefoldtech / rmb-rs

RMB implementation in rust
Apache License 2.0
3 stars 1 forks source link

rmb gives twin not found error for valid twin #83

Closed abom closed 2 years ago

abom commented 2 years ago

Quoting @muhamadazmy

if u send a message to remote twin, then u waited some time (say until the cache of the twin is cleared), and then u tried to send a message again, u will get a twin not found error, I guess that's a cache implementation issue!

abom commented 2 years ago

It gives the following error

2022-08-04T14:29:42.013Z DEBUG [rmb::http_workers::work_runner] can not retrieve twin from substrate for this id '114' because of Rpc error: The background task been terminated because: Networking or low-level protocol error: WebSocket connection error: connection closed; restart required
abom commented 2 years ago

The reason was clear that websocket connection is dropped, I tried to see why it's dropped nearly after 1min, I tried to check the subtx or even jsonrpsee-client but didn't reach anything, wither the client or even the server who closes the connection (I thought there should be something to keep this connection alive)

anyway, I'll go for the easy solution, which is reconnecting again manually as this feature is not yet implemented for subxt, see this issue here.

abom commented 2 years ago

After some trials, the same connection is dropped in case it was idle for sometime. I added a simple reconnecting client where it would build a new substrate client in case it's not connected.

mohamedamer453 commented 2 years ago

Verified on devnet.

I sent a message first then i left rmb idle for about 25 minutes i sent another message and as seen in the screenshot below the client was disconnected and a new one was rebuilt automatically and the message was received sucessfully.

image

image