talkjs / talkjs-examples

TalkJS (https://talkjs.com) examples
118 stars 119 forks source link

TalkJS in Blazor - basic example #385

Open mucalo opened 1 year ago

mucalo commented 1 year ago

I added a basic example of adding a TalkJS chat to an existing Blazor WebAssembly app.

I added the folder blazor/blazor-wasm-basic-example.

In that folder there is a .NET solution which is a Blazor WebAssembly app.

In that app there is a TalkJsChatComponent which is a reusable component that adds a TalkJS chat anywhere in the code where it is used. It relies on Talk being initialized via Vanilla Javascript (as in the Getting started documentation) and a wrapper around it I call TalkAux existing. The Blazor component uses JSInterop to call existing Javascript functions.

The "main" content is in Index.razor - to run you need to configure the AppId in that file.

I've written the whole blog article about this and it is available in the Article.md file in the project root.

Looking forward to receiving a review.