radu-matei / websocket-manager

Real-Time library for ASP .NET Core
https://radu-matei.com/blog/real-time-aspnet-core/
MIT License
452 stars 182 forks source link

WebSocketHandler: Added virtual OnInvokeMethodReceived for custom behaviour. #63

Closed Henry00IS closed 6 years ago

Henry00IS commented 6 years ago

This allows me to use the original library without having to hack logic into the source to for example prefix method calls and find the method in different classes compared to just one file (my WebSocketHandler).

Additionally:

Henry00IS commented 6 years ago

Here is an example of why I need this to be virtual.

My client calls a method like this:

image

Which will arrive at my server's new processing method:

image

Now I can call my fancy methods in different classes depending on the prefix:

image

And yes this ᐅ character is awesome. I use it for when you have 0 references to indicate this is called through reflection. In case you were wondering. It also prevents people from calling methods I didn't intend to be called. Last time I had to change this entire library but this one virtual method makes it all possible.