Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
570 views
in Technique[技术] by (71.8m points)

SignalR - How do I disable WebSockets

I upgraded to .NET 4.5, now SignalR seems insistent on using WebSockets in Firefox/Chrome - even though I'm only on Windows 7 which doesn't have a WebSocket Server.

The request obviously fails:

Firefox can't establish a connection to the server at ws://www.site.local/signalr?connectionData=

How do I force SignalR to forget about Websockets and use Long Polling, or is there a way of setting up Websockets for Windows 7 that I'm missing?

Update.... I'm using SignalR 0.4:

  <package id="SignalR" version="0.4.0" />
  <package id="SignalR.Hosting.AspNet" version="0.4.0.0" />
  <package id="SignalR.Js" version="0.4.0.1" />
  <package id="SignalR.Server" version="0.4.0.0" />
  <package id="SignalR.StructureMap" version="0.4.1" />
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found the answer here:

https://github.com/SignalR/SignalR/wiki/SignalR-JS-Client

Basically:

$.connection.hubs.start({ transport: 'longPolling' }, function() {
    console.log('connection started!');
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...