fix: use secure websocket (#5297)

This commit is contained in:
DarkSky
2023-12-13 21:58:22 +08:00
committed by DarkSky
parent 6724e5a537
commit ae4c201e40
@@ -7,9 +7,16 @@ export function getIoManager(): Manager {
if (ioManager) {
return ioManager;
}
ioManager = new Manager('/', {
autoConnect: false,
transports: ['websocket'],
});
const { protocol, hostname, port } = window.location;
ioManager = new Manager(
`${protocol === 'https:' ? 'wss' : 'ws'}://${hostname}${
port ? `:${port}` : ''
}/`,
{
autoConnect: false,
transports: ['websocket'],
secure: location.protocol === 'https:',
}
);
return ioManager;
}