Skip to content
  • Our Product
    • Namazu Elements
      • What is Elements?
      • Why open source?
      • Docs
        • Namazu Elements in Five Minutes or Less
        • RESTful APIs Library
        • Security Model
        • Accessing the Web UI (CMS)

    Our Product

    A logomark with three layered rhombuses adorning the lettermark that says Elements in bold all-caps sans-serif letters.
    • What is Namazu Elements? Discover our easy-to-use backend network solution built for online games. Rapidly enables full-scale multiplayer games or online solo adventures.
    • Why open source? Is there a truly open source server backend for connected games? There is now. Download and run a local copy of Namazu Elements and try it for yourself.
    Download Namazu Elements

    Get started

    • Quick start Read our Elements 5-minute quick start guide
    • Documentation Read our developer docs for learning more about Elements
    • RESTful APIs A full list of core API specs for working with the Elements framework
    • Security An overview of the server-authoritative security model of Elements
    • Accessing the CMS Manage your game with ease via the Namazu Elements CMS.

    Co-development Reimagined

    • Best real-time game backends in 2026 If you're researching an alternative to your current backend solution, we've prepared a report of all of the backend solutions on the market in 2026 and how Namazu Elements compares.
      Co-dev

    Recent Posts

    • The watercolor-styled Namazu Studios logo over a giant namazu lurking in the depth
      Namazu Studios Featured in San Diego Business Journal
      22 Sep 2025 Press
    • Namazu Elements 3.1 Released – Service Layer Fixes, Secure APIs, and Steam Bug Fix
      22 Apr 2025 Release Notes
  • Case Studies
  • About Us
  • News
  • Services
  • Book a call
namazu-studios-logo
Book a call
Popular Search Roblox

Getting Started

  • Namazu Elements in Five Minutes or Less
  • Overview
  • Accessing the Web UI (CMS)
  • CMS Feature Overview

Fundamentals

  • Why You Need a Server (and What “Authoritative” Means)
  • Elements as a Game Runtime
  • Where Your Authoritative Code Runs
  • Lifecycles and Flows

General Concepts

  • Custom Elements
  • Data Models
  • Security Model
  • N-Tier Architecture

Namazu Elements Core Features

  • Email Service
  • Applications
  • Sessions
  • Users and Profiles
  • Digital Goods
  • Progress and Missions
  • Progress and Missions (3.4+)
  • Leaderboards
  • Matchmaking – Comprehensive Guide
  • Friends
  • Followers
  • Product Bundles and SKUs
  • Item Ledger
  • Receipts
  • Reward Issuances
  • Save Data
  • Metadata
  • Metadata (3.4+)
  • Queries
  • User Authentication / Sign In
    • What is a User?
    • Email Verification
    • User Authentication in Elements
    • Account Linking
    • Setting Up Twitch OIDC Login (Backend)
    • OIDC Login for Thick Clients (Browser Redirect Flow)
    • Auth Schemes
      • Auth Schemes
      • OAuth2
      • OIDC
  • Features
    • Web3
      • Wallets
      • Vaults
      • Omni Chain Support
      • Smart Contracts
        • Smart Contracts
  • Queries
    • Advanced Operators
    • Object Graph Navigation
    • Boolean Queries
    • Base Query Syntax
  • Advanced Operators
    • .name
    • .ref

Your Game Code - Adding Custom Elements

  • Custom Code Overview
  • Windows Setup
  • Mac OS Setup
  • Ubuntu Linux Setup
  • Element Anatomy: A Technical Deep Dive
  • Introduction to Guice and Jakarta in Elements
  • Structuring your Element
  • Events
  • Packaging an Element with Maven
  • Deploying an Element
  • Preparing for code generation
  • Properties
  • Websockets
  • RESTful APIs
  • Direct MongoDB Access (3.5+)
  • Building the Example Element: A Complete Walkthrough
  • Building the Kotlin Example Element: A Complete Walkthrough

Configuration

  • Configuring External URLs for Deployment
  • Matchmaking – Comprehensive Guide
  • Direct Database Access and Batch Configuration
  • Connecting Namazu Elements to a TLS-Enabled MongoDB Replica Set
  • Batch Samples
    • Mission Upload Bash Script Sample
    • Item Upload Bash Script Sample

RESTful APIs

  • Importing into Postman
  • RESTful APIs Library
  • Swagger and Swagger UI

Add-Ons

  • Crossplay
    • Crossfire Client Libraries (JVM & Browser)
    • Crossfire Protocol Reference
    • Crossfire: Custom Matchmaking Algorithms
    • Namazu Crossfire (Multiplayer)
    • Deploying Namazu Crossfire in your game
  • Roblox
    • Roblox Overview
    • Secure Player Authentication & Registration
    • Global Matchmaking
    • Roblox Security Best Practices
  • Container on Demand
    • Namazu Conductor
    • Namazu Conductor Admin API
    • Configuring Namazu Conductor Providers
  • Commerce
    • Stripe
      • Stripe
      • Configuring the Stripe Element
      • Stripe REST API Reference
      • Stripe REST API Reference

Game Engine & Client Support

  • Unity
    • Elements Unity Plugin
    • Unity Crossfire Plugin
  • Gamemaker
    • Incorporating GMEXT-Elements into a GameMaker Project

Troubleshooting

  • Common Issues with Docker
  • Local SDK
    • Unable to deploy application : dev.getelements.elements.sdk.exception.SdkElementNotFoundException
    • Could not load class : java.lang.NoClassDefFoundError
  • Namazu Elements Community Edition
    • Common Issues with Docker
    • Unable to deploy application : dev.getelements.elements.sdk.exception.SdkElementNotFoundException
    • Running in the IDE
      • Exception in monitor thread while connecting to server localhost:27017
      • Could not deployAvailableApplications Jetty server Failed to bind to /0.0.0.0:8080 Address already in use

Releases

  • 3.8 Release Notes
  • 3.7 Release Notes
  • 3.6 Release Notes
  • 3.5 Release Notes
  • 3.4 Release Notes
  • 3.3 Release Notes
  • 3.2 Release Notes
  • 3.1 Release Notes
View Categories
  • Home
  • Docs
  • Add-Ons
  • Crossplay
  • Crossfire Client Libraries (JVM & Browser)

Crossfire Client Libraries (JVM & Browser)

Est. read time: 5 min read

AI Doc Summarizer Doc Summary
AI Doc Summarizer Thinking Thinking

Besides the Unity Crossfire Plugin, Namazu Crossfire ships two Java-based client libraries that speak the same wire protocol: a JVM/native client for desktop, server-to-server, and integration-test use, and a browser client compiled to JavaScript via TeaVM. Both sit on top of a small shared API so Application code can be written mostly against interfaces rather than against a specific WebRTC backend.


Module relationship diagram: api and common feed client, which client-onvoid and client-teavm implement; both, plus the separate Unity plugin, speak the same wire protocol to the server

The shared client API #

The client module defines the vendor-neutral surface both implementations expose:

  • Crossfire — the top-level facade. Obtain a builder from a CrossfireClientProvider (an SPI, discovered via META-INF/services), configure it, then connect(). Modes are combinations of Protocol (WebRTC or SIGNALING) and role (host or client) — e.g. WEBRTC_HOST. After connecting, call findMatchHost()/findMatchClient() (optionally scoped to a specific Protocol) to get the active peer collection, and subscribe to onHostOpenStatus/onClientOpenStatus for open/close notifications.
  • SignalingClient — the underlying handshake/signal transport. Exposes getState() (match id, host, Profile roster), backlog() (the buffered signals described in the protocol reference), signal(Signal), control(ControlMessage), and three handshake(...) overloads (fire-and-forget, callback, or blocking with a timeout). Its own phase enum mirrors the server’s connection state machine: READY → CONNECTED → HANDSHAKING → SIGNALING → TERMINATED.
  • MatchHost — start(), knownPeers(), findPeer(profileId), newPeerQueue(), onPeerStatus(...), close().
  • MatchClient — connect(), findPeer() (there’s only one — the host), newPeerQueue(), onPeerStatus(...), close().
  • Peer — one connected participant. getPhase() (READY/CONNECTED/TERMINATED), send(String)/send(ByteBuffer) (returns a SendResult: SENT/NOT_READY/ERROR/TERMINATED), and onMessage/onStringMessage/onError subscriptions.

Implementation-agnostic configuration is expressed as plain records, so the same values can be handed to either backend:

  • CrossfireIceServer — urls, username, password, hostname, tlsCertPolicy. CrossfireIceServer.googleDefaults() returns Google’s public STUN servers.
  • CrossfireDataChannelConfig — ordered, negotiated, maxPacketLifeTime, maxRetransmits, id, protocol. defaults() is ordered, non-negotiated, with no lifetime/retransmit caps.
  • CrossfireOfferOptions — voiceActivityDetection, iceRestart. defaults() has VAD on, ICE restart off.
  • CrossfireTlsCertPolicy — SECURE or INSECURE_NO_CHECK, for relaxing certificate validation against a local dev TURN/relay server using a self-signed certificate.

Both concrete implementations extend AbstractCrossfire, which handles the common bookkeeping: it subscribes to the SignalingClient‘s signals, and on receiving a HOST signal it works out — per supported protocol — whether the local peer is the host or a client, then builds a fresh set of MatchHost/MatchClient instances via two hooks the subclass supplies (populateHosts/populateClients). Application code normally never touches AbstractCrossfire directly.

JVM client (client-onvoid) #

Built on dev.onvoid.WebRTC:WebRTC-java (native WebRTC bindings) plus the Jakarta WebSocket client API for the signaling transport. This is the client to reach for in a JVM game server, a headless bot, or an integration test — not for a browser deployment.

Get a builder from OnvoidCrossfireClientProvider:

Crossfire crossfire = new OnvoidCrossfireClientProvider()
    .newBuilder()
    .withDefaultUri(URI.create("wss://your-server/app/ws/crossfire"))
    .withIceServers(List.of(CrossfireIceServer.googleDefaults()))
    .withDataChannelConfig(CrossfireDataChannelConfig.defaults())
    .build();

crossfire.connect();
MatchHost host = crossfire.findMatchHost().orElseThrow();

If no URI is supplied, the builder falls back to the ELEMENTS_CROSSFIRE_URI environment variable, then the dev.getelements.elements.crossfire.client.uri system property.

Host role: WebRTCMatchHost listens for CONNECT/DISCONNECT signals and lazily creates one offering peer (WebRTCOfferingPeer) per remote Profile as they connect. Client role: WebRTCMatchClient wraps a single answering peer (WebRTCAnsweringPeer) targeting whichever Profile the HOST broadcast signal names. Both share one native PeerConnectionFactory (SharedPeerConnectionFactory) and a single serialized executor for native WebRTC calls (SharedWebRTCExecutor) by default — override with withPeerConnectionFactory/withExecutor only if you need per-instance isolation.

CrossfireIceServer, CrossfireOfferOptions, and CrossfireDataChannelConfig map onto onvoid’s native RTCIceServer/RTCOfferOptions/RTCDataChannelInit types, including the TLS cert policy. Note that offer options only flow to the host (offering) side — the answering side always uses onvoid’s default RTCAnswerOptions.

Browser client (client-teavm) #

Compiles the same client abstractions to JavaScript using TeaVM, calling the browser’s native WebSocket and RTCPeerConnection directly through thin JSO overlays — no separate JS SDK to keep in sync with the Java protocol model. Get a builder from TeaVMCrossfireClientProvider; usage mirrors the JVM client:

Crossfire crossfire = new TeaVMCrossfireClientProvider()
    .newBuilder()
    .withDefaultUri(URI.create("wss://your-server/app/ws/crossfire"))
    .withIceServers(List.of(CrossfireIceServer.googleDefaults()))
    .build();

crossfire.connect();

The host/client peer roles work the same way as the JVM client (an offering peer per remote Profile on the host side, one answering peer on the client side), backed by plain HashMaps rather than concurrent collections, since generated JS is single-threaded.

Known gaps versus the JVM client — worth knowing before you assume feature parity:

  • withOfferOptions(...) and withDataChannelConfig(...) are accepted by the builder but currently have no effect on the browser target — data channels are always created with a hardcoded {"ordered":true} configuration. Don’t rely on custom retransmit/lifetime/negotiated settings in a browser build.
  • CrossfireIceServer.hostname and tlsCertPolicy are silently dropped when building the browser’s ICE server list — browsers manage their own TLS trust and don’t expose a knob to override it, so CrossfireTlsCertPolicy has no meaning here.
  • newPeerQueue() throws UnsupportedOperationException on both MatchHost and MatchClient in the browser build — a blocking queue would deadlock a single-threaded JS runtime. Use onPeerStatus(...) callbacks instead of polling a queue.

The client-teavm module pins an older Jetty version for its test/dev browser runner and excludes the Elements SDK BOM’s newer Jetty transitives to avoid a classpath conflict — if you fork this module’s build, keep that exclusion, or the embedded test server won’t start.

Choosing a client #

TargetModuleUse for
Unity (desktop/console/mobile)Unity Crossfire PluginShipping games built on Unity Netcode for GameObjects
JVM (native WebRTC)client-onvoidHeadless bots, load/integration tests, JVM-based game servers acting as a peer
Web browserclient-teavmBrowser-based game clients, browser-side test harnesses
What are your Feelings
Still stuck? How can we help?

How can we help?

Updated on August 14, 2026
Deploying Namazu Crossfire in your gameCrossfire Protocol Reference
Table of Contents
  • The shared client API
  • JVM client (client-onvoid)
  • Browser client (client-teavm)
  • Choosing a client
  • Documentation
  • Terms of Service
  • Privacy Policy
  • Contact us
  • Linkedin
  • Join our Discord

Namazu Studios LLC is powered by Namazu Elements, an open source modular backend framework for connected games.

Namazu Elements
  • Download
  • About Elements
  • Open source
  • Documentation
  • Support
Namazu Studios
  • Case Studies
  • About Us
  • News
Best realtime game backends 2026
Get in Touch
  • info@namazustudios.com
  • Book a call
  • (619) 862-2890
  • Linkedin
  • Discord

©2008-2026 Namazu Studios. All Rights Reserved.