signalr
signalr copied to clipboard
Client without Receiver, Server without Hub: Set specific handler funcs instead
Callback handlers in the client should not only be possible with public methods in a class given by the Receiver option, but also by passing single handler functions
action := func(param …interface{}) { ... }
NewClient(..., ReceiveFunc(„ProductUpdate“, action), ...)
Originally posted by @philippseith in https://github.com/philippseith/signalr/issues/65#issuecomment-922462238
The server interface could be extended using the same pattern:
method := func(param ...interface{}) []interface{} { ... }
NewServer(..., Method("AddProduct", method) ...)
ReceiveFunc can be used also with the server.