IN THIS ARTICLE
Testing the Web Communicator Cloud Gem
Testing the Web Communicator Cloud Gem
To perform a simple test of the Web Communicator cloud gem, you can use the CommunicatorSample level that is included with Lumberyard.
Prerequisites
This tutorial assumes the following:
- Your Lumberyard project has the Web Communicator and Player Account cloud gems enabled (in the Project Configurator , choose Cloud Gem Web Communicator and Cloud Gem Player Account).
- You used the
Cloud Canvas Resource Manager or the
lmbr_aws command line tool to create the following:
- A project stack for your project.
- A deployment for your project that includes the CloudGemWebCommunicator and CloudGemPlayerAccount resource groups.
- You have an email account for testing.
Test Workflow Summary
The test workflow uses the PlayerAccountSample level, the CommunicatorSample level, and the AWS IoT management console in the following ways:
PlayerAccountSample – To create an player account (authenticated identity) for testing. Web Communicator uses authenticated identities by default.
CommunicatorSample – To register a WebSocket, connect the WebSocket, and request a channel list.
AWS IoT management console – To publish a test message that appears in the CommunicatorSample level.
Test Workflow Steps
The following sections describe each of the workflow steps in detail.
A. Using PlayerAccountSample to Create a Player Account
In this step, you use the PlayerAccountSample level to create a player account and sign in with it.
To create a player account for the test
Follow Testing the Player Account Cloud Gem (steps 1-11) to create a player account. To verify the account, submit the verification code that is emailed to you.
With the PlayerAccountSample level still running, sign in to the PlayerAccountSample level with the credentials that you created (Testing the Player Account Cloud Gem step 12).
Press ESC to exit the level.
B. Using CommunicatorSample to Register and Connect a Websocket
In this step, register and connect a Websocket that can receive messages from AWS IoT.
To register and connect a Websocket
In Lumberyard Editor, choose File, Open.
In the Open a Level dialog box, choose CommunicatorSample, and then click Open. If you are using a launcher and need to restart, your authenticated identity should be found on startup.
Press Ctrl+G to start the level. The sample level looks similar to the following image.
Click Register WebSocket.
The status changes to Registered.
Click Connect WebSocket.
The status changes to Connected.
Click Request List.
Your test channels are listed in the sample level user interface.
Leave the CommunicatorSample level running.
Now that you have registered and connected a WebSocket, you are ready to test it.
C. Using the AWS IoT Management Console to Publish a Test Message
In this step, you send a test from the message AWS IoT console to the CommunicatorSample level.
To send a test message to the CommunicatorSample level
Do one of the following:
- Press Alt+Tab to change to your browser.
- Open a browser on another computer that has internet access.
In your browser, sign in to the AWS Management Console with the AWS credentials that you used to create your project stack and deployment.
Choose Services, Internet of Things, IoT Core to open the AWS IoT console.
In the left navigation pane of AWS IoT console, choose Test.
Navigate to the Publish section at the bottom of the page.
In the Publish section, enter the following information:
For Specify a topic, specify your channel as
project_name/deployment_name/CloudGemWebCommunicator
(for example,cgs624803/dep/CloudGemWebCommunicator
).For Message, add a message that uses the following syntax:
{ "Channel":"CloudGemWebCommunicator", "Message":"This is a test" }
Choose Publish to topic.
Return to the CommunicatorSample level to see the results. If you are on the same computer, press Alt+Tab to return to Lumberyard Editor.
The sample level shows the message that you sent from AWS IoT.