-
Notifications
You must be signed in to change notification settings - Fork 1
feat(platform): serve Chat from a JS host as an optional capability #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,6 +204,7 @@ describe("createWebWorkerPairingHostRuntime", () => { | |
| kind: "init", | ||
| logLevel: "debug", | ||
| hostConfig: hostConfigFromRuntimeConfig(config), | ||
| capabilities: { chat: false }, | ||
| }); | ||
|
|
||
| worker.emit({ kind: "ready" }); | ||
|
|
@@ -221,6 +222,23 @@ describe("createWebWorkerPairingHostRuntime", () => { | |
| provider.dispose(); | ||
| }); | ||
|
|
||
| it("reports the chat capability to the worker when the host serves it", async () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This covers the |
||
| const worker = new FakeWorker(); | ||
| void createWebWorkerPairingHostRuntime( | ||
| asWorker(worker), | ||
| makeHostCallbacks({ | ||
| chat: { createChatRoom: async () => ({ status: "New" }) }, | ||
| }), | ||
| { hostConfig: hostConfigFromRuntimeConfig(runtimeConfig()) }, | ||
| ); | ||
|
|
||
| worker.emit({ kind: "loaded" }); | ||
|
|
||
| expect(lastMessageOfKind(worker, "init").capabilities).toEqual({ | ||
| chat: true, | ||
| }); | ||
| }); | ||
|
|
||
| it("creates multiple product cores on one worker runtime", async () => { | ||
| const worker = new FakeWorker(); | ||
| const config = runtimeConfig(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A JS host that serves
chatcan create rooms, post messages and list rooms, but can never deliver an incoming message. Nothing in a wasm build can publish a chat action:ChatConnection::publish_actionis compiled out on wasm, and its only caller lives in thenativemodule, which is also compiled out. SoChat/action_subscribereturns a subscription that yields nothing and never ends, which a product cannot tell apart from a quiet room. Could you say here that JS-host chat is outbound-only for now, and open a follow-up issue for the inbound path. Custom-message rendering is native-only too.