[英]AWS Chime Messaging: How to add a new user to a channel using the JavaScript SDK
I'm building the back-end of a meeting app that will use AWS Chime Messaging SDK for JavaScript .我正在构建一个会议应用程序的后端,它将使用AWS Chime Messaging SDK for JavaScript 。 The idea is that when a user enters a meeting, an
AppInstanceUser
is created and associated with the Channel
of that meeting.这个想法是,当用户进入会议时,将创建一个
AppInstanceUser
并将其与该会议的Channel
相关联。
Creating the channel and associating the user with it looks quite simple with the JavaScript SDK, however I can't find a way to create the user other than through the CLI , which I don't think is the correct way, because I need to create a new AppInstanceUser
for each new user.使用 JavaScript SDK 创建频道并将用户与其相关联看起来非常简单,但是除了通过 CLI之外,我找不到创建用户的方法,我认为这不是正确的方法,因为我需要为每个新用户创建一个新的
AppInstanceUser
。
How should I do this?我应该怎么做? Is there a method to create the
AppInstanceUser
using the SDK that I didn't find?有没有一种方法可以使用我没有找到的 SDK 创建
AppInstanceUser
? Or is there a way to add the new user to the channel without creating a new AppInstanceUser
?或者有没有办法在不创建新
AppInstanceUser
的情况下将新用户添加到频道?
AWS SDK provides a client for creating AppInstanceUser's. AWS SDK 提供了一个用于创建 AppInstanceUser 的客户端。 If you are using NodeJS, you can access it with
aws-sdk/clients/chime
.如果您使用的是 NodeJS,则可以使用
aws-sdk/clients/chime
访问它。 After you initialize the client, you can call createAppInstanceUser
, provide it your AppInstanceArn
, AppInstanceUserId
and create your users, associate them to channels with createChannelMembership
, etc.初始化客户端后,您可以调用
createAppInstanceUser
,向其提供您的AppInstanceArn
、 AppInstanceUserId
并创建您的用户,使用createChannelMembership
将它们关联到频道等。
Last note, you still have to save your AppInstanceUserArn
in your user data, then use the stored ARNs in your application, client or server (at least that is my experience).最后一点,您仍然必须将
AppInstanceUserArn
保存在您的用户数据中,然后在您的应用程序、客户端或服务器中使用存储的 ARN(至少这是我的经验)。
I am not very familiar with how chime sdk meeting works.我不太熟悉 sdk 会议的工作原理。
But If you application requires users to log in to the application, You would create an AppInstanceUser for the user during their onboarding using their userId (example: sub if you're using cognito or database primary key) and associate that user with the AppInstanceUser .但是如果您的应用程序需要用户登录到应用程序,您可以在用户入职期间使用他们的 userId 为用户创建一个AppInstanceUser (例如:如果您使用的是 cognito 或数据库主键,则为 sub)并将该用户与AppInstanceUser相关联。 (example: by storing this in a database column and/or a cognito attribute)
(例如:将其存储在数据库列和/或 cognito 属性中)
So whenever a meeting is created you could add all the AppInstanceUsers of the meeting a ChannelMembership for the meeting channel.因此,无论何时创建会议,您都可以将会议的所有 AppInstanceUsers 添加到会议频道的 ChannelMembership。
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-chime-sdk-messaging/index.html - Chime Messaging Client allows you to do things like Adding Channel Membership https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-chime-sdk-messaging/index.html - Chime Messaging Client 允许您执行诸如添加频道成员资格之类的操作
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-chime-sdk-identity/index.html - Chime Identity Client allows you to do things like creating AppInstanceUsers https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-chime-sdk-identity/index.html - Chime Identity Client 允许您执行创建 AppInstanceUsers 等操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.