@geastack/core 0.1.40 → 0.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/index.d.ts +6 -1
- package/package.json +1 -1
- package/runtime-surface.ts +1 -0
package/README.md
CHANGED
|
@@ -57,6 +57,21 @@ target integration in `geastack/simulator`. Contributions should include a
|
|
|
57
57
|
reproduction and target-specific validation. Lifecycle and representation
|
|
58
58
|
changes need to preserve the shared component and native-type contracts.
|
|
59
59
|
|
|
60
|
+
## Native WebSocket connection headers
|
|
61
|
+
|
|
62
|
+
`@geastack/core` 0.1.41 and `@geastack/host` 0.1.16 add an optional third
|
|
63
|
+
WebSocket constructor argument for connection headers on ESP32 native hosts:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const socket = new WebSocket('wss://api.openai.com/v1/live/sessions', '', {
|
|
67
|
+
headers: [{ name: 'Authorization', value: `Bearer ${process.env.OPENAI_API_KEY}` }],
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Use these paired versions or newer when a service requires bearer authentication
|
|
72
|
+
in the WebSocket handshake. Header names and values are validated before the
|
|
73
|
+
connection starts. This native option is unavailable in browser WebSockets.
|
|
74
|
+
|
|
60
75
|
## Related packages
|
|
61
76
|
|
|
62
77
|
- `@geastack/engine` renders the element tree, `@geastack/host` supplies the
|
package/index.d.ts
CHANGED
|
@@ -1971,13 +1971,18 @@ export interface WebSocketInstance {
|
|
|
1971
1971
|
}
|
|
1972
1972
|
|
|
1973
1973
|
export interface WebSocketConstructor {
|
|
1974
|
-
new (url: string, protocols?: string | string[]): WebSocketInstance
|
|
1974
|
+
new (url: string, protocols?: string | string[], options?: WebSocketOptions): WebSocketInstance
|
|
1975
1975
|
readonly CONNECTING: 0
|
|
1976
1976
|
readonly OPEN: 1
|
|
1977
1977
|
readonly CLOSING: 2
|
|
1978
1978
|
readonly CLOSED: 3
|
|
1979
1979
|
}
|
|
1980
1980
|
|
|
1981
|
+
/** Native connection headers. Browser WebSockets do not support this option. */
|
|
1982
|
+
export interface WebSocketOptions {
|
|
1983
|
+
headers: { name: string; value: string }[]
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1981
1986
|
declare global {
|
|
1982
1987
|
const WebSocket: WebSocketConstructor
|
|
1983
1988
|
}
|
package/package.json
CHANGED