Skip to content

Expose conversation connections globally#522

Open
kai-stra wants to merge 9 commits intomainfrom
ks/expose-livekit-and-websocket-connections
Open

Expose conversation connections globally#522
kai-stra wants to merge 9 commits intomainfrom
ks/expose-livekit-and-websocket-connections

Conversation

@kai-stra
Copy link
Copy Markdown
Contributor

This will allow javascript like browser extensions to interact with the conversation, and also allow developers to debug in the console. Currently exposing only what I'm specifically using as although this technically doesn't introduce any malicious capabilities, would prefer to trivialise it less.

@AngeloGiacco AngeloGiacco requested review from kraenhansen and removed request for AngeloGiacco February 19, 2026 15:39
@AngeloGiacco
Copy link
Copy Markdown
Collaborator

would prefer kraen takes a look given he is working a bunch on this sdk

@kraenhansen
Copy link
Copy Markdown
Collaborator

kraenhansen commented Feb 19, 2026

Generally speaking, I am refactoring this class to avoid the instanceof checks on this.connection. Would it be possible to support this via sub-classing instead? Or is this intended to not require changes to the calling code?

I'm not a super-fan of patching the global like this. Would it make sense to add a properly typed debugger const exported from the package which the connection registers itself into instead?

@kai-stra
Copy link
Copy Markdown
Contributor Author

Generally speaking, I am refactoring this class to avoid the instanceof checks on this.connection. Would it be possible to support this via sub-classing instead? Or is this intended to not require changes to the calling code?

I'm not a super-fan of patching the global like this. Would it make sense to add a properly typed debugger const exported from the package which the connection registers itself into instead?

Yeah so I wanted to keep changes minimal - this does introduce one additional check but given the refactoring isn't done, can we save this for afterwards? Happy to help refactor this when the time comes, though it should not be much work.

As for the global patch, it's not nice but the only method of creating state that both the extension and other javascript has access to is by patching a global variable. This is so that external javascript through the dev console or browser extensions can interact with it.

Copy link
Copy Markdown
Collaborator

@kraenhansen kraenhansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed an alternative approach on Slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants