Hi,
I have downloaded the Module Zero (5.4) having ABP (3.6.1) with MVC and JQuery Template project for .Net Core 2.0. I am following the document <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/SignalR-AspNetCore-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a> for implementing SignalR.
I installed the Nuget packet Abp.AspNetCore.SignalR in the .Web.Core Project. Then in the .Web.Mvc project, startup.cs file I wrote the first line as #define FEATURE_SIGNALR
Now the below line (after using statements )(these lines were already there in the project) throwing errors... #if FEATURE_SIGNALR using Owin; using Abp.Owin; using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; using Abp.AspNetZeroCore.Web.Owin; using Owin.Security.AesDataProtectorProvider; #endif
Also following line in Configure method of Startup.cs is not compiling. #if FEATURE_SIGNALR //Integrate to OWIN app.UseAppBuilder(ConfigureOwinServices); #endif
Also following line of code is not compiling....
#if FEATURE_SIGNALR private static void ConfigureOwinServices(IAppBuilder app) { GlobalHost.DependencyResolver.Register(typeof(IAssemblyLocator), () => new SignalRAssemblyLocator()); app.Properties["host.AppName"] = "iVend365";
app.UseAbp();
app.UseAesDataProtectorProvider();
app.MapSignalR();
}
#endif
Please help me what should I fix to proceed and complete the SignalR implementation.....
Regards, Mahendra
9 Answer(s)
-
0
Those lines are for old SignalR, so don't enable them.
-
0
Thanks...I did that...Now following the document <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/SignalR-AspNetCore-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a> at the following step..."Client-Side (jQuery)", I included below lines in my Area/Mpa/Views/Layout/_Layout.cshtml file....
<script src="~/lib/signalr-client/signalr.min.js"></script> <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.signalr-client.js"></script>
Now when I run any of my pages, it throws me following error:
abp.signalr-client.js:97 Uncaught TypeError: Cannot read property 'WebSockets' of undefined at startConnection (abp.signalr-client.js:97) at Object.abp.signalr.connect (abp.signalr-client.js:47) at abp.signalr-client.js:107 at abp.signalr-client.js:110
Please help...
-
0
could you please provide me a sample application that uses signalR to send and receive message from Client and Vice-versa....
-
0
-
0
I created a sample SignalR project (I am not talking about ABP or Module Zero Here). Normal ASP.Net Core Application.
My startup class has following code.
app.Map("/signalr", map => { map.UseCors(CorsOptions.AllowAll); var hubConfiguration = new HubConfiguration{}; map.RunSignalR(hubConfiguration); });
Now there is another application (say windows application) who wanted to connect to my application using signalR. So the windows application use the following code to connect to my Hub hubConnection = new HubConnection("http://localhost:18444/signalr/hubs");
Please see the URL of Hub in the above code. When I browse the above URL (<a class="postlink" href="http://localhost:18444/signalr/hubs">http://localhost:18444/signalr/hubs</a>), it gives me following output...
/*!
- ASP.NET SignalR JavaScript Library v2.2.2
- <a class="postlink" href="http://signalr.net/">http://signalr.net/</a>
- Copyright (c) .NET Foundation. All rights reserved.
- Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
*/
/// <reference path="....\SignalR.Client.JS\Scripts\jquery-1.6.4.js" /> /// <reference path="jquery.signalR.js" /> (function ($, window, undefined) { /// <param name="$" type="jQuery" /> "use strict";
if (typeof ($.signalR) !== "function") { throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js."); } var signalR = $.signalR; function makeProxyCallback(hub, callback) { return function () { // Call the client hub method callback.apply(hub, $.makeArray(arguments)); }; } function registerHubProxies(instance, shouldSubscribe) { var key, hub, memberKey, memberValue, subscriptionMethod; for (key in instance) { if (instance.hasOwnProperty(key)) { hub = instance[key]; if (!(hub.hubName)) { // Not a client hub continue; } if (shouldSubscribe) { // We want to subscribe to the hub events subscriptionMethod = hub.on; } else { // We want to unsubscribe from the hub events subscriptionMethod = hub.off; } // Loop through all members on the hub and find client hub functions to subscribe/unsubscribe for (memberKey in hub.client) { if (hub.client.hasOwnProperty(memberKey)) { memberValue = hub.client[memberKey]; if (!$.isFunction(memberValue)) { // Not a client hub function continue; } subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue)); } } } } } $.hubConnection.prototype.createHubProxies = function () { var proxies = {}; this.starting(function () { // Register the hub proxies as subscribed // (instance, shouldSubscribe) registerHubProxies(proxies, true); this._registerSubscribedHubs(); }).disconnected(function () { // Unsubscribe all hub proxies when we "disconnect". This is to ensure that we do not re-add functional call backs. // (instance, shouldSubscribe) registerHubProxies(proxies, false); }); proxies['myHub'] = this.createHubProxy('myHub'); proxies['myHub'].client = { }; proxies['myHub'].server = { broadCastToAllClients: function (whomToSend) { return proxies['myHub'].invoke.apply(proxies['myHub'], $.merge(["BroadCastToAllClients"], $.makeArray(arguments))); }, connect: function (User) { return proxies['myHub'].invoke.apply(proxies['myHub'], $.merge(["Connect"], $.makeArray(arguments))); }, sendToServer: function (msg) { return proxies['myHub'].invoke.apply(proxies['myHub'], $.merge(["SendToServer"], $.makeArray(arguments))); } }; return proxies; }; signalR.hub = $.hubConnection("/signalr", { useDefaultPath: false }); $.extend(signalR, signalR.hub.createHubProxies());
}(window.jQuery, window));
Question is What would be my hub URL in Module Zero project. My startup class has following code: app.UseSignalR(routes => { //routes.MapHub<AbpCommonHub>("/signalr"); routes.MapHub<iVend365Hub>("/signalr"); });
Appreciate your response.
Regards, Mahendra
-
0
http**:**//localhost:18444/signalr
-
0
When I browse <a class="postlink" href="http://localhost:62114/signalr">http://localhost:62114/signalr</a> it gives me the following response... Connection ID required
-
0
Continued: #5122@77a7522f-ec19-4767-9247-442f610b0156