omni/connect/core/LiveSessionChannel.h
File members: omni/connect/core/LiveSessionChannel.h
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once
#include "Api.h"
#if OMNICONNECTCORE_WITH_NUCLEUS
#include <memory>
#include <string>
#include <vector>
namespace omni::connect::core
{
class OMNICONNECTCORE_API LiveSessionChannel
{
public:
// clang-format off
enum class MessageType
{
eJoin,
eHello,
eGetUsers,
eLeft,
eMergeStarted,
eMergeFinished,
eInvalid
};
// clang-format on
struct User
{
std::string id;
std::string name;
std::string app;
};
struct Message
{
MessageType type;
User user;
};
using Messages = std::vector<Message>;
using Users = std::vector<User>;
static std::shared_ptr<LiveSessionChannel> create(const std::string& uri, bool sendJoinMessage = true);
~LiveSessionChannel();
bool isConnected() const;
bool sendMessage(MessageType messageType) const;
Messages processMessages();
static const char* getMessageTypeName(LiveSessionChannel::MessageType messageType);
Users getUsers(bool includeSelf) const;
User getUser() const;
void leaveChannel();
private:
LiveSessionChannel();
class ChannelImpl;
ChannelImpl* m_impl;
};
} // namespace omni::connect::core
#endif // OMNICONNECTCORE_WITH_NUCLEUS