rpc-codec
rpc-codec copied to clipboard
Support for method name mapping
I'm converting a legacy system from Python into Go, and I have some restrictions on the method names that don't work with Go's RPC layer and rpc-codec. The legacy method names are all lowercase and do not have a namespace structure "namespace.method". rpc-codec works great for me with a small hack to add "default." and capitalize the first letter of the method name. Is there an interest in making this part of rpc-codec. If desired, I could change this to a more generic "method transform" callback.
see:
https://github.com/tdterry/rpc-codec/commit/a61f13113f33560272a2063bde9cf7a881f74690
This should be implemented in net/rpc, otherwise we'll have to implement this in each codec… Can you please ask Go developers about adding this feature into net/rpc? If they're willing to do this, in any way, then it's better to send PR to net/rpc. If they'll refuse to add this feature - then I'll accept PR with generic method transform callback.
Thanks. I've submitted https://github.com/golang/go/issues/16449. We'll see if there is any interest.
Looks like net/rpc has been frozen due to problems, and they are recommending alternatives such as http://www.grpc.io/
https://github.com/golang/go/issues/16844
@powerman Given that net/rpc has been frozen, are you open to add this feature in powerman/rpc-codec? It makes migrating from other JSON-RPC implementation to this repo a lot easier.
@libreoscar Given that net/rpc has been frozen, I think better solution should be to reimplement JSON RPC 2.0 as new package which doesn't depend on net/rpc. This helps to avoid several ugly workarounds required because of net/rpc and enable new features like method name mapping. But meanwhile we can add this feature here if anyone will send me good enough PR with tests.