Skip to content

Commit 4d7d9b7

Browse files
committed
Extracted conversation ID as a parameter
1 parent 8588c17 commit 4d7d9b7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

blazor/blazor-wasm-basic-example/Components/TalkJsChatComponent.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
if (MyUser != null && OtherUsers != null && OtherUsers.Count > 0 && !string.IsNullOrEmpty(AppId))
3333
{
34-
await jsRuntime.InvokeVoidAsync("TalkWrapper.createConversation", AppId, MyUser, OtherUsers, OUTPUT_DIV_ID);
34+
await jsRuntime.InvokeVoidAsync("TalkWrapper.createConversation", AppId, MyUser, OtherUsers, OUTPUT_DIV_ID, "MY_CONVERSATION_ID");
3535
}
3636
}
3737
}

blazor/blazor-wasm-basic-example/wwwroot/talkjs-wrapper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ window.TalkWrapper = {
88
* @param {object} myUser - object with parameters needed to create a Talk.User object
99
* @param {object} otherUsers - array of objects with parameters needed to create Talk.User objects
1010
* @param {string} outputElementId - Id of the element where we want the window to be output to
11+
* @param {string} conversationId - unique Id of the conversation being created
1112
*/
12-
createConversation: function (appId, myUser, otherUsers, outputElementId) {
13+
createConversation: function (appId, myUser, otherUsers, outputElementId, conversationId) {
1314

1415
// Create a Talk.User object for me
1516
var me = new Talk.User(myUser);
@@ -21,7 +22,7 @@ window.TalkWrapper = {
2122
});
2223

2324
// Create a conversation with a unique conversation ID
24-
var conversation = this.talkSession.getOrCreateConversation("CONVERSATION_ID");
25+
var conversation = this.talkSession.getOrCreateConversation(conversationId);
2526

2627
// Add myself as a participant
2728
conversation.setParticipant(me);

0 commit comments

Comments
 (0)