Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocols that include methods whose name begins with underscore not supported #16

Open
leomoisio opened this issue Aug 3, 2020 · 4 comments

Comments

@leomoisio
Copy link

Underscore appears to be legal first character for a method name in jsonrpc 2.0 but the implementation won't allow such method to be found - there's an explicit check against it in https://github.com/koorchik/node-mole-rpc/blob/master/MoleServer.js#L54 and this is even documented to be the case.

So currently the library can't be used with a protocol that has such method names in use.

@koorchik
Copy link
Owner

koorchik commented Aug 5, 2020

It is done intentionally. A common convention is to start private methods with an underscore.
Could you describe your use case where underscore is required? I could add an option to ignore this check

@leomoisio
Copy link
Author

My use case is to work with a protocol that already has such methods whose names begin with underscore, and I can't change the protocol. I need to be able to receive and respond to such requests.

@koorchik
Copy link
Owner

koorchik commented Aug 6, 2020

Yes, it makes sense to add an option like "allowPrivateMethods" or something like that.
Is it a real case or a hypothetical situation?

@leomoisio
Copy link
Author

It's a real case for a proprietary API, it did block me from using the library for this particular purpose.

Would it make sense to allow the exposed server class have a resolver method that gets the name of the jsonrpc method and tells which method to call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants