LogoLogo
API Status
  • 👋Welcome
  • 🌐What is Morpheus Platform?
    • Interoperability
  • ℹ️Help
    • 📗Glossary
    • 🆘Support
    • Firewall problems
    • EULA
  • CREATION
    • 🎮Unreal Development
      • ⚡Get Started
        • ⚒️Download the Editor
        • ⏫Upload Content
        • 🌎Creating your own map
        • 📝Morpheus Base Project
        • ❓Differences from Unreal
          • 🧍Character Configuration
        • 📡Morpheus Networking
          • Introduction to Morpheus Networking
          • Network Levels
          • Replicated Properties
          • RPCs
          • Morpheus Render Targets
          • Morpheus Array
          • Networking FAQ
          • Replicating Sublevels
      • 📚Features & Guides
        • 📒Example Plugin
          • Nameplates
          • In-game roles
          • Resizing
        • 🏊Actor Pooling
        • 🔊Audio
        • 🎭Avatars
          • Creating an Avatar
          • Attachments
            • MML Attachments
          • Custom Animation Variables
          • Importing an NFT collection
          • Capsules and Mesh Transforms
        • 🤖Bots
        • 🎙️Chat
          • Unreal Text Chat
        • 🎛️Control Panels
          • Control Panel Configuration
          • DJ booth mission control
          • Observer Controls
        • 🔉Crowd Audio
        • 🤼Crowd Rendering
          • Legacy Animated Crowd
            • Animated Crowd Console Commands
            • Attaching static meshes to crowd members
          • Crowd Materials
          • Performance Parameters
          • Live Config Settings
          • Crowd Animation
            • Crowd Anim Blueprint
              • User Guide - Crowd Anim Blueprint
              • Reference Guide - ABP Nodes
                • Animation Playback
                • States and State Machines
                • Variables
                • Transitions
                • Special
                • Blends
                • Additional Notes
        • 🍱Helpers & Extras
          • "Instanced Objects" in Blueprints
          • Objects with "world context"
          • Making DataAsset classes
          • Duplicate Objects
          • The Bootflow Subsystem
          • The "Wait For Condition" System
          • Advanced Graphics settings
          • Listening to inputs on UObjects
          • Morpheus UserID
          • World Services
          • M2Extras: Skins System
        • 🖥️Loading Screen
        • ⚡Live Config
          • Editing for a World
          • Editing Locally
          • Default Settings
          • Accessing via Blueprint
          • Adding New Settings
          • Overriding Defaults
          • Using Arrays
        • 🧊MML
        • 🕺Motion Capture
        • 📡Networking
        • 📢Notifications
        • Raycastable Crowd
        • 🌐Singletons
        • 📱Streaming & Multiplatform
          • GFN on mobile
        • 🖥️UI
          • "UI Mode"
        • 🗃️User Collections
          • Creating a New Object Definition
          • Accessing from Unreal
            • Creating Objects Definitions
            • Transfer Objects
            • User Collection Views
            • Receiving Updates
        • 📺Video Players
          • Embedded Video Player
          • Millicast video streaming
            • How to Setup an In-Game Video Stream
            • Picture-in-Picture mode
          • Streaming Video Player
            • How to Setup a URL Video Player
            • Picture-in-Picture mode
        • 🐞Visual Debugging
          • Inspector
        • 🪟Web UI
        • Online Services
          • KV Store Service
        • 💠Web Requests
          • Http Requests
            • Legacy HTTP Nodes
          • JSON Handling
          • WebSockets
          • Identity Validation
          • Allowed External URLs
          • Walkthrough Example
            • Example Counter Service
        • ✈️World Travel
          • World Travel in the editor
        • Avatar Physics Assets
        • Action Gameplay Helper Components
      • 🔑Workflows
        • ↗️Upgrade the Editor
          • 🖥️Version History
        • ⚙️Editing Project Settings
        • 📈Profiling
        • 🧺Marketplace Importing
        • 🛠️Extra Workflows
          • Setup Play-in-Editor
          • Setup Local Asset Validation
          • Adding Gameplay Tags
          • Validating Game Assets
          • Custom Connection Modes
          • Connect Editor to a World
          • Common Issues
      • 📚Useful Reading
        • ⭐Best Practices
    • 🌎Worlds
      • 📩Invite Players
        • Setting Role Groups
      • Persistent Worlds
      • Always on Worlds
    • 📅Running events
      • ✅Large scale events - Checklist
      • 👾Anti-Cheat (EAC)
      • 🎮Player Entry
        • 📱React Native
        • Steam
        • 💻Hardware Reqs
      • 🎥Broadcast
        • 📹OBS Integration
      • Failover
      • 🏁Capacity And Queue Management
  • ADMINS
    • 👪Access Control
      • Adding metaverse contributors
      • Creating a new project
    • 💲Pricing
      • Development Support
      • Included Usage & Overages
      • Cloud Streaming
      • Access Modes
      • War Room Support
      • Platform SLA
    • ⚙️Settings
      • 🗃️Projects
  • APIs and Tooling
    • 🖥️API Reference
      • Accounts
      • Events
      • Key/Value Store
      • Organizations
      • Realtime
      • User Profile
      • World Builder
      • Worlds
    • 💻Template Web App
      • 💢Moderation
    • Pixel Streaming
    • 🚀Launcher
  • Integrations
    • 📊Analytics
      • Sending events from web
      • 🎮Sending Events from Unreal
    • 💬Chat
      • 🎮Integrating Pubnub with your Unreal Project
      • Adding Moderation to Chat
Powered by GitBook
On this page

Was this helpful?

  1. APIs and Tooling
  2. API Reference

Realtime

Provides real-time updates from the Key/Value Store via WebSockets. Ideal for live data synchronization between game clients and backend services.

PreviousOrganizationsNextUser Profile

Last updated 6 days ago

Was this helpful?

🖥️

Connect to the realtime service

get

Creates a websocket connection to the realtime service, sending messages to the realtime service will subscribe you to different resources allowing you to listen to document updates in realtime. When subscribing if a resource doesn't exist yet a listener will be created and will be triggered when the resource is created. If the resource is deleted the listener will still exist so make sure to unsubscribe when you no longer need the resource.

When connecting via a html websocket you will need to parse all of your headers in through Sec-WebSocket-Protocol which is an optional header that takes in a string. Format for the string needs to be a list of headers split by \n and key value split by : and then encoded into base58

Example format

x-m2-organization:testOrg x-m2-project:testProj

Example messages for subscribing to the resources available in the realtime service -

  • KVStore:

      {
          "action": "subscribe",
          "resource": {
              "type": "kvStore",
              "id": "World:kvstoreClient:testKey"
          }
      }
    
  • Collections:

      {
          "action": "subscribe",
          "resource": {
              "type": "collection",
              "id": "public"
          }
      }
    
  • Liveconfig:

      {
          "action": "subscribe",
          "resource": {
              "type": “liveConfig",
              "id": “game"
          }
      }
    

Using the same format, you can also unsubscribe from the resources by changing the action to "unsubscribe" and sending the same resource.

Example response formats below.

Success:

    {
      "userId": "fakeUserId",
      "resource": {
          "type": "collection",
          "id": "private"
      },
      "data": {
          "userId": "fakeUserId",
          "datasourceId": "fakeDatasourceId",
          "userCollection": []
      },
      "version": "2024-01-30T15:50:35.742Z"
    }

Warning:

    {
      "warning": "resource_not_found",
      "message": "KVStore resource doesn't currently exist, subscription was still made successfully"
    }

Error:

    {
      "error": "Invalid message format"
    }
Authorizations
Header parameters
x-m2-organization-idstringRequired

The ID of an organization

x-m2-project-idstringOptional

The ID of a project

x-m2-world-idstringOptional

The ID of a world

Responses
101
Default Response
application/json
Responseany of
stringOptional

Provides information about the service status.

or
or
4XX
The error object returned by the API when an error occurs
application/json
get
GET /api/realtime/connect/ HTTP/1.1
Host: your-organization-id.m2worlds.io
x-api-key: YOUR_API_KEY
x-m2-organization-id: text
Accept: */*
text