Insights

The Four Components to Every Virtual Space

Oliver Carson on Dec 12, 2022
The Four Components to Every Virtual Space

The Four Components to Every Virtual Space

Every modern application, regardless of industry, is a Virtual Space if it provides an online place where people can engage with each other just as authentically as they could face-to-face in the real world. Virtual Spaces are digital environments where people and devices around the world can easily collaborate, socialize, create new experiences, and exchange information in real time. If you’ve ever collaborated with co-workers on shared documents, signed on to a video conference call, or played a video game with people from around the world, you were in a Virtual Space.

Virtual Spaces are playing an important role as the foundation for the future of the internet and how people engage with each other online. Web3 is attempting to usher in a new change in the internet with more secure, private, and decentralized applications that allow users and creators to have ownership over their own data. Developers creating applications now need to keep in mind the growth and direction of their applications, ensuring that their applications allow for this interoperability of ownership and allow for multimedia from all sources to be able to access their applications.

The Metaverse is an immersive, virtual world where people live, work, shop, and interact with others online and in real time. Virtual Spaces are the individual pieces that make up these interactions and social connections in virtual environments. There already exist simulations of the Metaverse in the real world through different virtual reality systems. Virtual reality devices (VR technology) such as Meta’s Oculus Quest, is a VR headset that allows players to interact with virtual reality applications such as Beat Saber, a rhythm game that uses motion tracking to slash beats to music using small handheld controllers as the input devices. Augmented reality uses your phone to add virtual objects to the physical world, such as Pokémon Go adding Pokémon to your current location. Mixed reality is similar to augmented reality, but requires a wearable, head-mounted display to create a more immersive experience by adding virtual objects to their space. Microsoft’s HoloLens is a head-mounted display that enables users to boost manufacturing, visualize construction projects, and even provide accessible and efficient healthcare by adding virtual objects to their overlay in the real world.

As you are developing your applications with these ideas in mind, you’ll need to be aware of these ideas that are vital to the success of your application and its users so it can thrive in the future of the internet. But what truly makes an application a Virtual Space?

What Makes an App a Virtual Space?

Although you more than likely have been in one, not all applications are Virtual Spaces. Every Virtual Space consists of the following four important components:

  1. Space: Digital environment where users collaborate.

  2. Messages: How data/communication (a message, a signal, visual status, or remote action etc.) is transmitted between endpoints.

  3. Users & Memberships: Involves two or more endpoints (people and devices) and how they send messages to one another in real time.

  4. Business Logic: How the interactivity (receipt and exchange of messages) is defined and occurs in real time.

Furthermore, time and duration don’t make something a Virtual Space. For instance, a Virtual Space could be as short as the duration of a football match, or as long as the Slack channels you use to communicate with coworkers. The attribution of successful Virtual Spaces is due to the common similarities between them, such as being scalable, highly-customizable, enabling real-time engagement, and enhancing functionality and user experience.

Each of the four components, Space, Users, Messages, and Control, is defined as a way to break-down Virtual Spaces in PubNub so that developers can better understand what is happening in their online applications and what it means to create a truly immersive experience in a virtual world.

Space

In a Virtual Space, Spaces are where interactions happen between Users and allow them to collaborate in different ways. Although every space is different based on the purpose of the application, Spaces are the logical representation of the Virtual Space that one or more Users can become a member of. You can think of Spaces as a layer that defines the rules for the permission level of your users and how they interact with each other in your application.

Spaces are essentially a collection of channels, which, as defined within PubNub’s real-time data API, are mechanisms through which the data is transmitted from one device to another. These channels can be used to divide spaces based on different interactions, such as how Slack users have different threads, channels, and conversations they are communicating in.

These interactions define what type of messages can be sent within a space and the rules that are associated with them. Spaces handle the complex channel topology that developers would normally have to handle and instead supports Message and Event types so that clients can interact with each other (more in the Messaging and Business Logic sections). Spaces also define rules about which type of Users are permitted to create an instance of the space, mapping role permissions to Users, and other PubNub configurations on that space. This can be things such as which Users are permitted to be a part of that space, paid tier plans, subscriber benefits, what occurs when users come online, and even administrative level control. When Users send messages that contain things such as the typing indicator event triggers, chat or file messages, the Space processes this information before being received by other Users.

Here are some examples of how a Space operates in applications:

  • Group Chat applications such as Slack may have different spaces such as “main”, “ask-engineering”, or “ask-it”. They contain the members associated with each space, the messages in a thread, presence channels to determine who is online, a typing indicator channel to determine who is typing at a given time, and the space settings.

  • A 1:1 Chat conversation will need its own member list, space settings, message channel, presence channel, typing indicator channel, and so forth.

  • A “Driver-passenger” space in a driver delivery application may contain its member list, space settings, message channel, presence channel, geo-location channel, and so on.

  • A “Home” space for a home automation app where a home may (internally) contain its member list, space settings, message channel, device-command channel, presence channel, etc.

  • In the VR experience VRChat, environments are generated where player-controlled avatars can interact with one another in an immersive virtual reality experience.

Messages

Messages are how Users communicate through PubNub and are delivered through channels in a Space. Messages are commands that are essentially API requests for different actions, such as publishing a message, receiving messages, event handlers, and so forth.

Messages have different types: publish, signal, typing indicators, presence, message reactions, and files. Once a command is executed, such as publishing a chat response using a real-time chat API, responses called Events are generated to act upon the message depending on the command executed and the configuration of the Space (more on this in the Business Logic section).

Messages contain payload and metadata properties. The payload property is the actual data that is being transmitted, while the metadata property is used as a free-flowing JSON property where you can forward important application information about the payload.

Without messages, Virtual Spaces would not exist - you need data to be communicated between users and a way to infer what types of messages are being submitted in order to be able to properly handle and process the information.

Users & Memberships

Users are people, devices, or even systems that act as endpoints to execute commands in the PubNub network. Users are actors in these real-time interactions and are essential to powering your application, as they are the entities that access the PubNub APIs.

Users are associated with a type to differentiate them in their specific use case, as Users in an IoT application will invoke real-time streaming APIs rather than Users using PubNub’s real-time chat API for chat applications. These User types allow developers to control/deny access and find specific Users when performing filters. Users have presence, meaning you can get currently active Users in Spaces or detect when new Users come online/leave. You can also make use of Users containing general and custom data in the form of key-value stores that you might want to store for your unique application use.

Clients are Users on which one of PubNub’s Client SDKs is installed and through which a User accesses PubNub resources. Clients then are essentially computing systems such as mobile phones, computers, and IoT devices through which the User accesses PubNub.

Memberships define a relationship between a User and a Space. The User is a member of that Space whether or not they are online. While you need to build and define the Membership yourself, Memberships allow developers to store information about Users that are relevant to the Space they are associated with, such as how many messages a User has responded to in that Space or specific User selected settings.

Memberships not only allow developers to help Users find Spaces that are important to them but allow developers to define rules between a User and a Membership, such as the type of membership (level of access/permissions) a User has and the status of the Membership (presence/access control).

Business Logic

The Business Logic, or Control, defines the boundaries or rules of a Virtual Space. This control allows you to change your PubNub Virtual Space by altering user roles and permissions, how messages flow through the system, and even how events are processed.

Developers and other business users are able to access a portal interface that allows them to enable or disable features, as well as define certain rules or events to trigger these features. It allows for fine-tuning of your application and does not alter or require updates to the codebase.

Defining rules and managing access for Users to access specific channels, user information, and other features in your application are needed for Virtual Spaces to properly function. You should be able to set up a detailed permission schema for your application and be able to decide who can do what with your data, successfully securing your application.

You also need a way to moderate how messages flow through the system. You need to be able to moderate and filter messages for any inappropriate content, as well as be able to respond to flagged users for inappropriate behavior. These flagged users should be blocked, muted, or banned completely from your application depending on your organization’s policies.

As briefly described earlier, when Clients make API calls such as publishing a message or subscribing to a channel, it generates Events that other Clients can listen for and handle as soon as the Command is executed. Hooks offer the ability to write custom logic that gets triggered on a Command before it is executed, such as before a message or signal publish Command. Contradictory,  Actions are the configurable ways to transmit data after a command is triggered, such as after a message or signal publish Command. Events, Actions, and Hooks provide a way for you to centrally manage all the events that are happening in your application and trigger additional business logic using listeners.

PubNub’s Virtual Spaces Platform

PubNub’s Virtual Spaces Platform offers a collection of features and capabilities using their real-time data APIs that are already powering thousands of the world’s leading Virtual Spaces. Developers can leverage the power of PubNub’s real-time data APIs to send any number of Messages to any number of Users. Developers can control how these Users interact with Spaces, the rules associated with the Spaces, and which Users are allowed to access your application, including their permission levels. You’re also able to control how your Virtual Space functions and flows, allowing for an experience that is truly unique. If you would like to learn more about PubNub’s Virtual Spaces Platform, be sure to check out our resources below.

  • Learn how Virtual Spaces are the future of real-time interactions.

  • Read how Virtual Spaces enable businesses to create enriching and engaging apps.

  • How to create shared digital experiences with ease.

  • Watch how apps and platforms can leverage Virtual Spaces to remain competitive.

  • Enhance the fan experience through Virtual Spaces.

Talk with one of our experts to learn more about how PubNub can help you create your Virtual Space for your customers.