signalr

signalR CORS - IE client gets 403 'Forbidden: JSONP is disabled'

一曲冷凌霜 提交于 2019-12-10 11:09:52
问题 We implemented SignalR 2.0 hub with CORS enabled. Javascript clients on Firefox and Chrome are running fine. IE 10 gets error 403. Any help will be appreciated. Thank you and regards. 回答1: While IE 10 (but not IE ≤9) should support CORS, if you find yourself needing to use JSONP you can enable it when you call MapSignalR . Enabling JSONP allows your SignalR app to be accessed from any origin while sending cookies/credentials. With CORS, you can limit which origins are able to access your

Why Context.User.Identity.Name is null in Windows Form Hub Context?

本秂侑毒 提交于 2019-12-10 10:49:07
问题 I need to pass User.Identity.Name to Windows Form client. Method public override Task OnConnected() { string userName = Context.User.Identity.Name; string connectionId = Context.ConnectionId; var user = Users.GetOrAdd(userName, _ => new User { Name = userName, ConnectionIds = new HashSet<string>() }); lock (user.ConnectionIds) { user.ConnectionIds.Add(connectionId); if (user.ConnectionIds.Count == 1) { Clients.Others.userConnected(userName); } } return base.OnConnected(); } But Context.User

Regarding hosting SignalR in console apps

北城余情 提交于 2019-12-10 10:19:59
问题 i got a code which host SignalR in console apps. here is the code. Install-Package Microsoft.Owin.Hosting -pre Install-Package Microsoft.Owin.Host.HttpListener -pre Install-Package Microsoft.AspNet.SignalR.Owin -pre using System; using Microsoft.AspNet.SignalR; using Microsoft.Owin.Hosting; using Owin; namespace SignalR.Hosting.Self.Samples { class Program { static void Main(string[] args) { string url = "http://172.0.0.01:8080"; using (WebApplication.Start<Startup>(url)) { Console.WriteLine(

How to notify database changes with signalR

谁都会走 提交于 2019-12-10 09:56:48
问题 I've just started with SignalR and would like to try out the real time notifications. The objective is to keep displaying the updated message on web page. There is a database table - DummyData with a column Message . This table has only one record - Hello When the page loads, "Hello" is displayed. I then manually run the command in sql server 2012 update DummyData set Message='hello world' , but the message isn't updated in the webpage. aspx: <script> $(function () { var notify = $.connection

How to make SignalR behave gracefully in case of disconnection

こ雲淡風輕ζ 提交于 2019-12-10 09:37:45
问题 My application will often be used under fucked up corporate networks (proxy, firewalls, etc.) so I can not rely on sockets and long-polling is practically my only option. Here is my biggest problem with long-polling: Long-polling is disconnected at some point of time I automatically reconnect (accoring to documentation) User clicks something that causes hub method call but connection is not established yet - error happens. Is there any way to synchronize hub method call and reconnection like:

implement signalR without jquery

不羁岁月 提交于 2019-12-10 04:33:20
问题 is it possible to implement SignalR without the use of Jquery. I want to create a module for Titanium, but I don't know how dependent SignalR is on the DOM. Is jQuery used just for the ajax request? how hard do you think this would be? 回答1: Um its not impossible but it'll be abit of work. you will basicly need to re-write all jquery syntax ($...) in Jquery.signalR.js as regual javascript. Also you will only be able to do low level connections as the "hub" model also requires jquery. You will

SignalR WebRTC WebSocket is already in CLOSING or CLOSED state

独自空忆成欢 提交于 2019-12-10 03:09:14
问题 I wanted to take a test run of the simplest implementation of SignalR and WebRTC. I hosted the code in https://github.com/foyzulkarim/WebRtc I made two different files "index.html" and "index1.html". In index.html I broadcasted a video file through signalr and it went very well. But when I just replace existing video file with WebCam's feed, it started getting error. After running couple of second I start getting this error "WebSocket is already in CLOSING or CLOSED state." I tried to

Signalr assembly loading issue OWIN

一曲冷凌霜 提交于 2019-12-10 03:05:55
问题 I'm getting this error when attempting to load classes in the Microsoft.AspNet.SignalR.Owin assembly. The exception is thrown after execution leaves the Configuration method in startup.cs . I've registered a Global Exception Handler to try and catch the exception but it is not being caught. public async override Task HandleAsync(ExceptionHandlerContext context, CancellationToken cancellationToken) { var exception = context.Exception; const string genericErrorMessage = "An unexpected error

SignalR not working with Windows-integrated authentication

六眼飞鱼酱① 提交于 2019-12-10 03:04:20
问题 I have an ASP.NET MVC 4 app (.NET 4.5) and SIgnalR works fine with forms-based authentication (hosted via IIS/IIS Express) As soon as I change the app to windows-integrated authentication ( <authentication mode="Windows"/> in "web.config") it stops working. jquery.signalR-2.2.2.min.js:9 WebSocket connection to ws://localhost:51030/signalr/connect?transport=webSockets&blhablahblah failed: Error during WebSocket handshake: Unexpected response code: 403 After adding the [Authorize] attribute to

Use of /signalr/ping call when using long polling

*爱你&永不变心* 提交于 2019-12-10 02:41:57
问题 I'm using long polling with SignalR. I've found that user session ends (ASP.NET Session_End is being called) right after singalr based webpage makes /signar/ping request (as shown in this screenshot). I went through http://www.asp.net/signalr/overview/signalr-20/hubs-api/handling-connection-lifetime-events but couldn't figure out clear answers following questions. How to keep ASP.net user session alive from a signalr client webpage? What is the actual purpose of /ping? Is the timing for this