Rocky_Mountain_Vending/.pnpm-store/v10/files/51/7368603329440399c3ce2bd0d7fdf779adfcad38a8705ace58366887620356f385fb885c25f1141228a76c874ed9476bfc8fc5138692c462ea86c4389a63e3
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

22 lines
No EOL
858 B
Text

import { normalizedAssetPrefix } from '../../../shared/lib/normalized-asset-prefix';
function getSocketProtocol(assetPrefix) {
let protocol = window.location.protocol;
try {
// assetPrefix is a url
protocol = new URL(assetPrefix).protocol;
} catch {}
return protocol === 'http:' ? 'ws:' : 'wss:';
}
export function getSocketUrl(assetPrefix) {
const prefix = normalizedAssetPrefix(assetPrefix);
const protocol = getSocketProtocol(assetPrefix || '');
if (URL.canParse(prefix)) {
// since normalized asset prefix is ensured to be a URL format,
// we can safely replace the protocol
return prefix.replace(/^http/, 'ws');
}
const { hostname, port } = window.location;
return `${protocol}//${hostname}${port ? `:${port}` : ''}${prefix}`;
}
//# sourceMappingURL=get-socket-url.js.map