Vote count:
0
My signalr is working on same url "localhost/page_a.aspx" but if i want to send same datas to "/page_b.aspx" , signalr is not invoke .
page_a.aspx;
<script src="Scripts/jquery-2.1.1.min.js"></script>
<script src="Scripts/jquery.signalR-2.1.2.min.js"></script>
<script src="signalr/hubs"></script>
<script type="text/javascript">
$(function () {
var chat = $.connection.toAdmin;
chat.client.broadcastMessage = function (data) {
$(".hitCount").prepend(data);
};
$.connection.hub.start().done(function () {
$('#tikla').click(function () {
chat.server.send("erdi");
});
});
});
</script>
in this code , if i click "btn" it adds "some text for testing" to html at the sametime in all browsers (i opened chrome,ie and firefox and its working).
But i want to send this data to page_b.aspx signalr is not working page_b.aspx;
<script src="Scripts/jquery-2.1.1.min.js"></script>
<script src="Scripts/jquery.signalR-2.1.2.min.js"></script>
<script src="signalr/hubs"></script>
<script type="text/javascript">
$(function () {
var chat = $.connection.toAdmin;
chat.client.broadcastMessage = function (data) {
$(".hitCount").prepend(data);
};
});
</script>
other important classes; startup.cs
using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(WebApplication2.Startup))]
namespace WebApplication2
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
and toAdmin.cs(page_b.aspx)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace WebApplication2
{
public class toAdmin : Hub
{
public void Send(string text)
{
Clients.All.broadcastMessage(text);
}
}
}
asked 1 min ago
SignalR send data to different url
Aucun commentaire:
Enregistrer un commentaire