Since chat messages are directed to channels, not users, so we create a chat channel before our test.

Configs messaging service:

Go get started, find the Chat Channel page on brainCloud portal.

  • Assuming you already Enabled chat service for your app from Design | Messaging | Chat page, if not, do it before starting the following test. Refer to this article for the detail.

  • Navigate to Design | Messaging | Chat Channels page, click [+New Channel] button and fill in the fields with essential values. Click the Save button to complete your creation.

  • You should find the channel you created on the list then.

Test:

  • Download the Unity chat test example from here. Unzip it and open it with Unity Hub.

  • Test from the editor as below or build it into any platform that fits your test device.

  • Logging your app from the brainCloud setting tab:

  • Run the game, fill in the [User Name] and [Password] input fields with any words you prefer, and click Auth button, you will see the success return like below.

  • Click enableRTT button from your Unity app, you should see the return as below with RTT connect success info.

  • Fill [chat channel id] field with the value "13229:gl:main" ( note: "13229" is your appId, "gl" represents a global channel, "main" is the global channel code which you created from the above step. Combine these three values with semicolons : , that will be your channel id), click the [connect to channel id] button. You will see the return info as below: (note: if you posted messages to this channel before, you will get a list of messages, otherwise, you won't see any messages here)

  • Go to brainCloud portal login the same app as above, find page Design | Cloud Code | API Explorer, authenticate with a new user which is different from the user above.

  • Select Chat Service and PostChatMessage Operation, put the same channelId that you used at the above step "13229:gl:main" and set the "content" values as below, hit Run.

  • You should find your Unity app return chat message is auto refreshed with this new message:

  • You can go-ahead to create a dynamic channel and test with it. Just make sure both users from Unity and portal are connected to the same channel.

Did this answer your question?