joncol / jcon-cpp

JSON RPC 2.0 library using C++ and Qt 6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: JSON RPC client error: key/value is undefined

sayezz opened this issue · comments

I try to receive notifications on client side. I have no control over the server and can only implement the client.
I am using your client example with notifications enabled.

The server from a different application sends this notification (I checked it via Wireshark):
{"jsonrpc":"2.0","method":"methodName","params":{"param1":"data"}}

When listening with your client I get the notification
Error: JSON RPC client error: key/value is undefined

I tried to test it by using your server to recreate the issue. When using your server this is what I see in Wireshark:
{"jsonrpc":"2.0","key":"methodName","value":{"param1":"data"}}

So the server against whom I develop does send method/params while your server sends key/value

  1. How do I send with your server method/params?
  2. What do I need to do on client side so I can receive method/params notifications

Best Regards
say

I don't know if thats correct, but when I change your source code and replace key/value in
QJsonDocument JsonRpcServer::createNotification(const QString& key, const QVariant& value)
and do the same on client side, everything works fine.

sayezz: Nice catch. Would you create a PR for this, maybe?