Filtering out SSE tests for browsers with no EventSource

This commit is contained in:
Pawel Kadluczka 2017-08-24 13:04:39 -07:00 committed by Pawel Kadluczka
parent cddc5f8a75
commit bcd5a1bd6e
2 changed files with 14 additions and 12 deletions

View File

@ -1,22 +1,24 @@
const ECHOENDPOINT_URL = `http://${document.location.host}/echo`;
function getTransportTypes() {
let transportTypes = [ signalR.TransportType.WebSockets ];
if (typeof (EventSource) !== "undefined") {
transportTypes.push(signalR.TransportType.ServerSentEvents);
}
transportTypes.push(signalR.TransportType.LongPolling);
return transportTypes;
}
function eachTransport(action) {
let transportTypes = [
signalR.TransportType.WebSockets,
signalR.TransportType.ServerSentEvents,
signalR.TransportType.LongPolling ];
transportTypes.forEach(t => action(t));
getTransportTypes().forEach(t => action(t));
}
function eachTransportAndProtocol(action) {
let transportTypes = [
signalR.TransportType.WebSockets,
signalR.TransportType.ServerSentEvents,
signalR.TransportType.LongPolling ];
let protocols = [
new signalR.JsonHubProtocol(),
new signalRMsgPack.MessagePackHubProtocol()
];
transportTypes.forEach(t =>
getTransportTypes().forEach(t =>
protocols.forEach(p => action(t, p)));
}
}

View File

@ -13,7 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.Sockets.Abstractions\Microsoft.AspNetCore.Sockets.Abstractions.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Sockets.Common.Http\Microsoft.AspNetCore.Sockets.Common.Http.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Sockets.Common.Http\Microsoft.AspNetCore.Sockets.Common.Http.csproj" />
</ItemGroup>
<ItemGroup>