1 const WebSocketServerSubdomain = 'docs-rts'
3 export const getWebSocketServerURL = () => {
4 const url = new URL(window.location.href)
5 const hostnameParts = url.hostname.split('.')
8 if (hostnameParts.length === 2) {
9 hostnameParts.unshift(WebSocketServerSubdomain)
11 hostnameParts[0] = WebSocketServerSubdomain
14 const newHostname = hostnameParts.join('.')
15 return `wss://${newHostname}${port.length > 0 ? ':' + port : ''}/websockets`