c# - SignalR always using longpolling -
i using signalr 2.0 beta. chrome, firefox, , ie10 see transport being used longpolling.
http://localhost:8080/signalr/poll?transport=longpolling&connectiontoken=123456
i running hub windows service, , have javascript hub proxies making connections client.
server-side code:
webapp.start<startup>("http://*:8080"); public class startup { public void configuration(iappbuilder app) { var config = new hubconfiguration { enablecrossdomain = true }; app.maphubs(config); } }
client-side code:
function configuremessaging() { var connectionmain = $.hubconnection('http://localhost:8080'); connectionmain.statechanged(connectionstatechanged); connectionmain.start({ waitforpageload: false, xdomain: false, jsonp: false }); var vmgrhub = connectionmain.createhubproxy("vmgrhub"); $("#broadcast").click(function () { vmgrhub.invoke('globalmessage', $("#msg").val()); }); vmgrhub.on('addglobalmessage', function (message) { $("#message").text(message); }); }
in production, application require cross-domain support, in example provided, windows service , javascript client on localhost.
how can websockets work in browsers support it?
thanks!
from signalr supported platforms
also note signalr use websockets, iis 8 or iis 8 express must used, , server must using windows 8, windows server 2012, or later.
Comments
Post a Comment