使用SignalR在集线器中调用class的方法
Calling method of class in hub using SignalR
我的集线器 class 有一些方法,客户端可以毫无问题地调用这些方法。但是怎么办,如果我想在集线器的属性中调用class的方法,例如:
Class MyHub
Inherits Hub
Sub HubMethod()
End Sub
Property SC As New SimpleClass
End Class
Class SimpleClass
Sub DoNothing()
End Sub
End Class
我想做类似 myHubInstance.Invoke("SC.DoNothing")
的事情。有可能吗?
你不能那样做。 SignalR 服务器通过检查类型是否派生自 IHub
.
使用反射发现集线器
我的集线器 class 有一些方法,客户端可以毫无问题地调用这些方法。但是怎么办,如果我想在集线器的属性中调用class的方法,例如:
Class MyHub
Inherits Hub
Sub HubMethod()
End Sub
Property SC As New SimpleClass
End Class
Class SimpleClass
Sub DoNothing()
End Sub
End Class
我想做类似 myHubInstance.Invoke("SC.DoNothing")
的事情。有可能吗?
你不能那样做。 SignalR 服务器通过检查类型是否派生自 IHub
.