Closed bretbas closed 2 years ago
I found out why this is happening. The point is that your generator does not add attributes that were set on real methods. I have several methods, and i override all method names:
[Authorize(IdentityPolicy.User)]
[HubMethodName("GetMessages")]
public async Task<IList<DisputeMessageResponse>> GetMessagesAsync(int disputeId, int skip = 0, int take = 10)
{
var messages = await _disputeMessageManager.GetMessagesAsync(disputeId, skip, take);
return _mapper.Map<IList<DisputeMessageResponse>>(messages);
}
So, I have two attribute here - Authorize and HubMethodName. This attributes not be included in the result generating.
You are right, this is on my to-do list, but I didn't have the time yet to implement it.
I try to implement it myself and make pull request
I took a look today and it's much simpler than I thought. I already have a working solution and can merge it tomorrow.
I found another error : Here you use .Name property, but need full type with namespace!
So, i fixed them. Pull request already created. Please check
thank you @bretbas for your PR. I noticed you made some changes that should be discussed separately.
And your solution is more complex than needed. I wanted to implement it the same way as you, but then I noticed that it's enough to use the ToString()
method of the attribute.
Please take a look at my PR #4.
Currently I support only method attributes, but I think class attributes should be supported as well.
Please check your PR on the attributes with named arguments. For example:
[Authorize(Policy = IdentityPolicy.Admin)]
Yes, I tested it and it works
Good, thanks.
So, can you try to develop SignalR.Modules.Client for javascript, flutter and other clients ?
I merged my PR now, please check if it works for you.
There is currently one limitation: if you use the HubMethodName
attribute, the name gets not prefixed with the module hub name.
I am unsure if the prefix should be added or not.
Regarding other clients, I have currently no plans to add any. Maybe a JavaScript client, but as I said, I don't have any plans yet. If you want to add another client, PRs are very welcome.
ok, thanks!
@bretbas Can we close this issue?
I generated several some hubs with your package, and i don't invoke any methods on the hub from front-end:
ERROR Error: Failed to invoke 'DisputeHub_GetMessages' due to an error on the server. HubException: Method does not exist.