-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add methodName to rpc methods to allow to determine methods after code minification #857
base: master
Are you sure you want to change the base?
Conversation
484e36a
to
e9bc55b
Compare
@dcodeIO any chance for merge? |
This reverts commit ed7e2e7.
Messages with optional fields will now implement their corresponding interfaces (IMessage) fixes protobufjs#834 fixes protobufjs#837
@@ -78,15 +78,15 @@ function performRequestOverTransportChannel(requestData, callback) { | |||
// Listen for events: | |||
|
|||
greeter.on("data", function(response, method) { | |||
console.log("data in " + method.name + ":", response.message); | |||
console.log("data in " + method.nameName + ":", response.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nameName
?
Can't you just do: function rpcImpl(method, ...) {
if (method == MyService.prototype.myMethod) { ... }
} |
@dcodeIO then you would need rpc transport layer to be dependent on all services. |
@dcodeIO This is quite cumbersome when building a transport that works with any proto file. Please consider merging this pr. |
…ice method names when generating static code, see #857
Does this solve it? Idea is that defining the |
@dcodeIO how to get a full method name (in format of |
In current state when static code is minified, generated method names are replaced by single letter names.
This make almost impossible to implement correctly transport layer for services.
Those changes adds new property to methods:
methodName
, that contains string to original method name.After this change you should determine called method using
methodName
instead ofname
, but old behavior is still preserved.Also this commit create new exported type:
RpcServiceMethod
to allow to access new property in type safe way.Runtime generated code was also extended with generated code.
Although methodName is appended in every runtime rpc call - I didn't found a way how to make it one time action in method generation.
Test case was also extended to make sure that
methodName
will containe the same value thatname
.Bonus:
I fixed Travis build issue for you :-) I don't like to have that red X in my PR ;-)