기술 자료

​
​

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
      • Initialize the Vivox SDK
      • Handle messages
        • Message callback
        • Message polling
      • Message types
      • Character encoding
      • Requests and responses
      • Create the connector object
      • Sign in to a game
      • Sign out of a game
      • Uninitialize the Vivox SDK
    • Channels
    • Presence management
    • Messaging
    • 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

Message callback

Understand how to use message callback to handle messages.
읽는 시간 2분
최근 업데이트: 8달 전

When you initialize the Vivox SDK, you need to set up your implementation to handle SDK messages. Using a callback method is the suggested best practice. This simplifies your game logic by only responding to messages when they occur, rather than using a polling loop that might be idle most of the time.
The callback is a parameter for
vx_sdk_config_t
, which is shown in the following
VxcTypes.h
example:
// When the SDK message callback is called, call vx_get_message() until there are no more messages. void (*pf_sdk_message_callback)(void *callback_handle);
The following example is built on code from the SDKSampleApp with extra details on using OnSdkMessageAvailable on a ListenerThread:
static vx_sdk_config_t MakeConfig(const SDKSampleApp &app, unsigned int default_codecs_mask, vx_log_level log_level = log_error){ vx_sdk_config_t config; vx_get_default_config3(&config, sizeof(config)); config.pf_logging_callback = OnLog; config.pf_sdk_message_callback = OnSdkMessageAvailable;}void OnSdkMessageAvailable(void *callbackHandle){ SDKSampleApp *app = reinterpret_cast<SDKSampleApp *>(callbackHandle); app->set_event(m_messageAvailableEvent);}void SDKSampleApp::ListenerThread(){ for (; m_started;) // Pulls a message from the queue. If no message found, waits until notified, then tries again. { wait_event(m_messageAvailableEvent, -1); for (;;) { vx_message_base_t *msg = NULL; vx_get_message(&msg); // Type of message, and then type of the Event or Response is discovered, and the // appropriate call is made to process that message type. if (msg == NULL) { break; } Lock(); HandleMessage(msg); Unlock(); vx_destroy_message(msg); } } set_event(m_listenerThreadTerminatedEvent);}
참고
The Vivox SDKSampleApp shows the use of a mutex while processing messages (the
HandleMessage()
function). This is a requirement of the SDKSampleApp, not the Vivox SDK. A mutex is only needed if your implementation requires it by design.
참고
Messages can be processed on the same thread as the callback or on a different thread.

Copyright © 2026 Unity Technologies
법률 정보개인정보 처리방침쿠키Documentation Terms of Use개인 정보 판매 또는 공유 금지개인정보 보호 선택(쿠키 설정)

'Unity', Unity 로고 및 기타 Unity 상표는 미국 및 기타 지역 내 Unity Technologies 또는 그 계열사의 상표 또는 등록상표입니다(자세한 내용은 여기에서 확인하세요). 기타 명칭 또는 브랜드는 해당 소유자의 상표입니다.

일부 페이지는 편의를 위해 기계 번역되었으며 부정확한 내용이 있을 수 있습니다. 정보가 상충되는 경우, 영어 버전을 우선으로 참조하세요.


    이 페이지의 문제 보고