chore: default appKey to 'websocket', add copilot instructions
This commit is contained in:
parent
46ce034aba
commit
fed6ee0d11
|
|
@ -0,0 +1,19 @@
|
|||
# blax-npm-networking
|
||||
|
||||
## Overview
|
||||
Plug-and-play API + WebSocket client for Vue/Nuxt apps. Framework-agnostic core with optional bindings.
|
||||
|
||||
## Build
|
||||
- `pnpm build` — builds via tsup to `dist/`
|
||||
- Exports: `.` (core), `./vue`, `./nuxt`, `./axios`
|
||||
|
||||
## WebSocket
|
||||
- `createWsClient()` takes a URL and connects via native WebSocket
|
||||
- `createFromNuxtConfig()` reads `runtimeConfig.public` keys: `WEBS_URL`, `WS_PROTOCOL`, `PUSHER_APP_KEY`
|
||||
- App key default: `websocket` — generic identifier, same in all environments
|
||||
- URL format: `{protocol}://{host}/app/{appKey}`
|
||||
- Has built-in connection diagnostics: URL validation, 5s timeout for `connection_established`
|
||||
|
||||
## Conventions
|
||||
- TypeScript strict mode
|
||||
- No environment-specific defaults — all config values should work across dev and prod
|
||||
|
|
@ -71,7 +71,7 @@ export function createFromNuxtConfig(options: NuxtNetworkingOptions = {}): {
|
|||
const serverUrlInternal: string = pub[serverUrlInternalKey] ?? ''
|
||||
const wsUrl: string = pub[wsUrlKey] ?? ''
|
||||
const wsProtocol: string = pub[wsProtocolKey] ?? 'wss'
|
||||
const appKey: string = pub[appKeyConfigKey] ?? ''
|
||||
const appKey: string = pub[appKeyConfigKey] ?? 'websocket'
|
||||
|
||||
// @ts-expect-error Nuxt/Vite global
|
||||
const isServer: boolean = import.meta.server ?? false
|
||||
|
|
|
|||
Loading…
Reference in New Issue