I’ve tried to rebuild the C# Persistent Connection Example I found on Github in VB.net but I can’t get it to work.
This is what I have done:
1) Creating a new Endpoint in a new VB Class
Imports SignalR
Imports System.Threading.Tasks
Public Class MyEndPoint
Inherits PersistentConnection
Protected Overrides Function OnConnectedAsync(request As IRequest, connectionId As String) As System.Threading.Tasks.Task
Return Connection.Broadcast("Connection " + connectionId + " connected")
End Function
End Class
2) Add routing into global.asax file
Public Class Global_asax
Inherits System.Web.HttpApplication
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RouteTable.Routes.MapConnection(Of MyEndPoint)("echo", "echo/{*operation}")
End Sub
End Class
I’ve got the following debug information:
Extension method ‘Public Function MapConnection(name As String, url As String, type As System.Type) As System.Web.Routing.RouteBase’ defined in ‘SignalR.RouteExtensions’ is not generic (or has no free type parameters) and so cannot have type arguments.
Any idea how I can rewrite this line of code to get it working?
RouteTable.Routes.MapConnection(Of MyEndPoint)("echo", "echo/{*operation}")
I was able to get the code to work by using the non-generic overload of the MapConnection extension method:
Hopefully that will get you going.