SAN*_*ANA 2 javascript jquery signalr asp.net-core-2.0
I have asp.net core web api server that is streaming a signalr, And it works for asp.net client , I am trying to make a connection with the code showen beelow but it only connects to a none core servers it wouldnt work for the core servers.
//the hub class in the server code
[EnableCors("AllowAllOrigins")]
[HubName("LogNotifierHub")]
public class LogNotifierHub : Hub
{
//methods defined here
}
Run Code Online (Sandbox Code Playgroud)
startup code for the routing :
app.UseSignalR(routes =>
{
routes.MapHub<LogNotifierHub>("/NotifierHub");
});
Run Code Online (Sandbox Code Playgroud)
javascript code for making the connection
var hubUrl ="http://localhost:52273/logNotifierHub";
var connection = $.hubConnection(hubUrl, { useDefaultPath: true});
var hub = connection.createHubProxy("LogNotifierHub");
hub.on('SendStreamInit', function(data){
console.log( data)
})
connection.start()
.done(function(){ console.log(' connected!! connection ID=' + connection.id); })
.fail(function(error){ console.log('Could not connect!!' + error); });
Run Code Online (Sandbox Code Playgroud)
小智 5
您不能混合和匹配 SignalR 服务器和客户端的版本。如果您在服务器上使用核心,那么您也必须在客户端上使用它。
SignalR for ASP.NET Core 与以前版本的 SignalR 不兼容。这意味着您不能将旧服务器与新客户端一起使用,也不能将旧客户端与新服务器一起使用。
| 归档时间: |
|
| 查看次数: |
2451 次 |
| 最近记录: |