asp.net mvc - Client doesn't make a connection to the SignalR server -
i'm trying implement signalr application. start things of started basic, reason i'm getting error whole time. pease have @ code , see i'm doing wrong. in advance.
starup code
using microsoft.owin; using owin; [assembly: owinstartupattribute(typeof(cdvportal.startup))] namespace cdvportal { public partial class startup { public void configuration(iappbuilder app) { configureauth(app); app.mapsignalr(); } } }
hub code
using system; using system.collections.generic; using system.linq; using system.web; using microsoft.aspnet.signalr; using microsoft.aspnet.signalr.hubs; namespace cdvportal.hubs { public class reservationshub : hub { public void newreservations() { clients.all.newreservation("hey works"); } } }
client side code
<script src="~/scripts/jquery-2.1.3.js"></script> <script src="~/scripts/jquery.signalr-2.2.0.js"></script> @*<script src="~/signalr/hubs"></script>*@ <script type="text/javascript"> (function () { var connection = $.hubconnection(); var hub = connection.createhubproxy('reservationshub') hub.on('newreservation', function (message) { alert(message); }); connection.start().done(function(){ hub.invoke('newreservations') }); }());
Comments
Post a Comment