window supports websockets

This commit is contained in:
Drew Ansbacher
2021-09-16 12:20:21 -06:00
committed by Matt Hill
parent 9dfdee283a
commit abeba45422
5 changed files with 9 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ export function PatchDbServiceFactory (
embassyApi: ApiService,
): PatchDbService {
const { mocks, patchDb: { poll }, isConsulate } = config
const { mocks, patchDb: { poll }, supportsWebSockets } = config
let source: Source<DataModel>
@@ -22,7 +22,7 @@ export function PatchDbServiceFactory (
source = new WebsocketSource(`ws://localhost:${config.mocks.wsPort}/db`)
}
} else {
if (isConsulate) {
if (supportsWebSockets) {
source = new PollSource({ ...poll }, embassyApi)
} else {
const protocol = window.location.protocol === 'http:' ? 'ws' : 'wss'