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
  • Usage Overview
  • Authentication
  • Connecting
  • Sending Messages
  • Handling Disconnection

Was this helpful?

  1. CREATION
  2. Unreal Development
  3. Features & Guides
  4. Web Requests

WebSockets

Interacting with web socket servers from Blueprint

PreviousJSON HandlingNextIdentity Validation

Last updated 8 months ago

Was this helpful?

You can connect to your web socket server to send/receive JSON messages from blueprint.

This feature is only available in V25 onwards

Usage Overview

To use the web socket connection, create a new instance of the M2 Web Socket Connection class and store it somewhere in a Blueprint graph.

Authentication

Optionally, call Set Actor Auth Context / Set Actor Component Auth Context passing the Morpheus Actor or Morpheus Actor Component you ant to use as the basis for your authentication.

As part of authentication you can select one of the M2 Web Platform scopes. If you do so, the following additional headers are added to the request:

Scope
Headers
Description

None

N/A

No extra headers are applied

Organization

x-m2-organization-id

Applies the current Organization Id of the Metaverse

Project

x-m2-organization-id

x-m2-project-id

Applies the current Organization Id and Project Id of the Metaverse

World

x-m2-organization-id

x-m2-project-id

x-m2-world-id

Applies the current Organization Id, Project Id and World Id of the Metaverse

Launch Context

x-m2-organization-id

x-m2-project-id

x-m2-launch-context-id

Deprecated Applies the current Organization Id, Project Id and Launch Context Id of the Metaverse

When connecting to your web socket server, the auth header will be passed in the initial http request headers as an Authorization: Bearer header.

Connecting

To connect to the Web Socket server you call the Connect method on the connection class.

The parameters are as follows:

Parameter
Description
Required

Url

The web socket URL to connect to. The wss or ws protocols must be specified.

Yes

Protocol

No

Headers

An optional Map<FString, FString> of headers to pass to your server as part of the handshake.

No

On Connected

A delegate that is called if the web socket successfully connects. When this event is received, you can send and receive messages.

No, but recommended

On Connection Error

A delegate that is called if the web socket fails to connect. If this is called, the web socket cannot be used until it is connected.

No, but recommended

On Disconnected

A delegate that is called if the web socket disconnects. This is called if the disconnection is user driven or the server connection is broken. If this is called, the web socket cannot be used until it is connected.

No, but recommended

On Message Received

A delegate that is called whenever the web socket receives a message from the server. Messages must be deserializable from a JSON string to be passed to your handler. If you do not provide this delegate, your socket will ignore any messages that are received.

No, but recommended

Sending Messages

Once your web socket is connected you can send messages via SendJson. This will take a JsonObject and send it to your remote server as a serialized string.

Handling Disconnection

Disconnection can be manually requested by calling the Disconnect event. This will send a default status of 1000 and no reason string.

Your web socket server connection may be disconnected for other means, such as network errors between the client and web socket server, problems in the web socket server or just that the connection is set to time out.

You can call Reconnect to connect to a web socket that has moved into the disconnected state; however you must have called Connect on it beforehand.

Due to the custom nature of many web socket services, we do not provide automatic reconnection logic. You must manage this yourself by calling Reconnect if required.

If you opt to include the delegated auth token, then the initial web socket connection will include an auth token used to help you .

This URL must conform to the requirements described in

An optional to pass to your server on connection. If not specified, this will default to empty.

🎮
📚
💠
validate the user's M2 Identity
Configuing External URL Access
subprotocol
Creating an instance of the M2 Web Socket Connection class
Connecting to a web socket
Sending a web socket message