signalr

SignalR: Error loading hubs

前提是你 提交于 2019-12-05 18:13:29
问题 Signalr doesn't load my hubs: SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>. I am calling app.MapSignalR(); in startup configuration . I added to my cshtml: <script src="~/Scripts/jquery-1.9.1.js"></script> <script src="~/Scripts/jquery.signalR-2.0.0.js"></script> <script src="~/signalr/hubs" type="text/javascript"></script> <script> $(document).ready(function () { window.hubReady = $.connection.hub.start(); }); </script> 回答1:

SignalR 2 long polling “protocol” request times out when not ran locally

家住魔仙堡 提交于 2019-12-05 17:45:51
Currently I have an app that is very chatty and needs to be supported by a Singleton(See Code below). I upgraded to SignalR 2.0 and I followed the upgrade guide, but after I deploy it out to an environment, sometimes all requests for every "protocol" fail, and signalr breaks, and when it doesn't break then it is terribly slow to push notifications down to the client from the server, Maybe this has something to do with it using long polling? Here is what my server side code looks like. Configuration Method in Owin Start up class var hubConfig = new HubConfiguration(); hubConfig

SignalR and WinRT client: Don't call Wait() on Start()

冷暖自知 提交于 2019-12-05 16:58:40
I have a question regarding SignalR's official documentation - Hubs API Guide - .NET Client . In the section - How to establish a connection . It has been written the following thing: The Start method executes asynchronously. To make sure that subsequent lines of code don't execute until after the connection is established, use await in an ASP.NET 4.5 asynchronous method or .Wait() in a synchronous method. Don't use .Wait() in a WinRT client. Does anyone know what is the specific reason not to call Wait()? Also, does also this apply when I have a WinRT client where I have a call with hubProxy

SignalR overwriting OnConnected(), OnDisconnected()

天涯浪子 提交于 2019-12-05 16:54:25
问题 I'm trying to overwrite OnConnected() , OnDisconnected() methods but I get: OnConnected()': no suitable method found to override Is implementing IDisconnect , IConnect interfaces and doing my processing within Connect() and Disconnect() the same as OnConnected() , OnDisconnected() ? what gives? public static class UserHandler { public static HashSet<string> ConnectedIds = new HashSet<string>(); } public class MyHub : Hub { public override Task OnConnected() { UserHandler.ConnectedIds.Add

AspNetCore.SignalR : Cannot start a connection that is not in the Initial state

江枫思渺然 提交于 2019-12-05 16:28:13
I have troubles to get my ASP.NET Core SignalR app working. I have this server-side code : public class PopcornHub : Hub { private int Users; public async Task BroadcastNumberOfUsers(int nbUser) { await Clients.All.InvokeAsync("OnUserConnected", nbUser); } public override async Task OnConnectedAsync() { Users++; await BroadcastNumberOfUsers(Users); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception exception) { Users--; await BroadcastNumberOfUsers(Users); await base.OnDisconnectedAsync(exception); } } whose SignalR Hub service is configured as : public

SignalR Negotiate 404

假装没事ソ 提交于 2019-12-05 15:43:07
问题 I am using SignalR 2.0. Everything works fine when running locally on my VS 2012. But when I publish the site on IIS, it breaks. The site loads but one of the scripts returns 404 Not Found. The script is something like. https://example.com/signalr/negotiate?xxx This path doesn't exist indeed. The correct path should be: https://example.com /private /signalr/negotiate?xxx Note the part in bold. Inside the WebSite (https://example.com/) I have another Application (https://example.com/private/).

How to write an NLog target using Signalr

徘徊边缘 提交于 2019-12-05 14:35:38
I'm trying to write a target for NLog to send messages out to connected clients using SignalR. Here's what I have now. What I'm wondering is should I be using resolving the ConnectionManager like this -or- somehow obtain a reference to the hub (SignalrTargetHub) and call a SendMessage method on it? Are there performance ramifications for either? [Target("Signalr")] public class SignalrTarget:TargetWithLayout { public SignalR.IConnectionManager ConnectionManager { get; set; } public SignalrTarget() { ConnectionManager = AspNetHost.DependencyResolver.Resolve<IConnectionManager>(); } protected

Signalr backplane oracle

和自甴很熟 提交于 2019-12-05 13:58:27
Is it possible to setup a signalr backplane based on an oracle database? We have 2 servers which have a signalr hub. Clients can be connected to server A or to server B. When we send a message through the hub on server A we also want that the users on server B get that message. We don't use azure since it's a internal company site. No sql server or redis as well. Thanks. Currently SignalR supports scale out by backplane only on , 1. Azure Service Bus 2. Redis 3. SQL Server see here : http://www.asp.net/signalr/overview/performance/scaleout-in-signalr Edit : SignalR source code is hosted on Git

Signalr CORS issue

不羁岁月 提交于 2019-12-05 13:53:50
On my server side I'm using web api 2 with signalr. On my client side I'm using angularjs. Here's the http request when I initiate the signalr connection: > GET > http://example.com/signalr/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22main%22%7D%5D&_=1416702959615 HTTP/1.1 Host: mysite.net Connection: keep-alive Pragma: no-cache > Cache-Control: no-cache Accept: text/plain, */*; q=0.01 Origin: > http://lh:51408 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) > AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 > Safari/537.36 Content-Type: application/x-www-form

Android client for SignalR does not receive but JS does

我怕爱的太早我们不能终老 提交于 2019-12-05 13:47:52
This is a "hello world" app but I can't find the solution. This is the code on the client: public class MainActivity extends ActionBarActivity { HubProxy proxy; EditText messageText; TextView resultText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Platform.loadPlatformComponent(new AndroidPlatformComponent()); //Setup connection String server = "http://10.0.2.2:8081/"; HubConnection connection = new HubConnection(server); proxy = connection.createHubProxy("chatHub"); Toast.makeText