文档

​
​

Development

User Acquisition

Monetization

工业

Vivox Core SDK

Vivox Core SDK

此页面不支持所选语言。
Vivox
​
​
Vivox Core SDK
  • Overview
  • Before you begin
  • Get started
  • Release notes
  • Developer Guide
    • Client SDK basics
    • Channels
    • Presence management
    • Messaging
      • Group text messages
      • Directed text
      • Send data through text messages
      • Text chat developer guide
    • Manage audio
    • Couch co-op
    • Android app development
    • iOS app development
    • macOS app development
    • Windows app development
    • Real-time recording
    • Speech-to-text audio transcription
    • Text-to-speech
    • Troubleshooting
  • Reference
  • Privacy overview
  1. Vivox Core SDK documentation

Send data through text messages

Learn how to send structured data using text messages.
阅读时间2 分钟
最后更新于 8 个月前

Vivox text messages can send additional, non-messaging data through two string variables:
  • Application stanza namespace
  • Application stanza body
The application stanza namespace carries Uniform Resource Identifier (URI) reference information that identifies an XML namespace. This URI identifies the kind of information you send in the application stanza body. For more information about how to format the URI, refer to the W3C documentation on XML Namespaces.
The application stanza body carries the data associated with the given application stanza namespace. If the data is text, it must be UTF-8 encoded. If binary, use base64 to encode with a maximum of 8k per message.
注意
This information is hidden from the player and is only accessible through the code.
You can hide messages if you need to keep them hidden from users. For example, you are using them only to send data with no visible message. One method to accomplish this is to label your application stanza namespace accordingly. For example, you can have an application stanza namespace named "
data:hidden
" or "
message:omit
". You can then check for all messages with the same application stanza namespace.
注意
Messages must contain data. You cannot send an empty message.
You can access the hidden data after it is received. You can access its application stanza body by grabbing the message from the function that receives it.

Core application stanza body

The following examples detail how to send hidden data through text messages and access hidden data from messages in the Vivox Core SDK.

Send hidden data in messages

string applicationStanzaNamespace = "team:color";string applicationStanzaBody = teamColor; //"red" or "blue"vx_req_account_send_message_t *req;vx_req_account_send_message_create(&req);req->account_handle = vx_strdup(accountHandle.c_str());req->message_body = vx_strdup(message.c_str());req->user_uri = vx_strdup(user.c_str());req->application_stanza_namespace = vx_strdup(applicationStanzaNamespace);req->application_stanza_body = vx_strdup(applicationStanzaBody);IssueRequest(&req->base);

Access hidden data from messages

if(evt->type == evt_message){ vx_evt_message *tevt = (vx_evt_message *)evt; if ( tevt->application_stanza_namespace == "team:color") { if( tevt->application_stanza_body == "blue") { //assign font blue } else if( tevt->application_stanza_body == "red") { //assign font red } else { //assign font grey } }}

SDKSampleApp

These examples mimic the
SDKSampleApp::HandleMessage(vx_message_base_t *msg)
function. For more information, refer to the SDKSampleApp.

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • Core application stanza body

    • Send hidden data in messages

    • Access hidden data from messages

    • SDKSampleApp


报告此页面的问题