INNER CODE UNIT · TypeScript

buildWebSocketUrl

prisma/prisma · apps/lsp-playground/src/client/main.ts:99

function buildWebSocketUrl(wsPath: string): string {
  const host = `${window.location.host}${wsPath}`;
  // nosemgrep: javascript.lang.security.detect-insecure-websocket.detect-insecure-websocket
  return window.location.protocol === 'https:' ? `wss://${host}` : `ws://${host}`;
}

async function main(): Promise<void> {
  const runtimeConfig = await loadRuntimeConfig();

  const pathEl = document.getElementById('schema-path');
  if (pathEl !== null) {
    pathEl.textContent = runtimeConfig.schemaPath;
  }

  const htmlContainer = document.getElementById('editor');
  if (htmlContainer === null) {
    throw new Error('#editor mount point not found');
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…