Filtering out SSE tests for browsers with no EventSource
This commit is contained in:
parent
cddc5f8a75
commit
bcd5a1bd6e
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue