Blog

12 days of BoxLang - Day 3: SocketBox!

Maria Jose Herrera December 12, 2025

Spread the word

Maria Jose Herrera

December 12, 2025

Spread the word


Share your thoughts

Day 3 of the 12 Days of Christmas: Real-Time Power with BoxLang + SocketBox šŸŽ„

As BoxLang continues evolving into a modern, high-performance, JVM-based runtime, real-time communication becomes essential for the applications we all want to build: dashboards, collaboration tools, notifications, live feeds, multiplayer features, and more.

That’s whereĀ SocketBoxĀ steps in — the WebSocket upgrade listener built to work seamlessly withĀ CommandBoxĀ and theĀ BoxLang MiniServer. ⚔

Today, for Day 3, we’re highlighting howĀ SocketBox supercharges BoxLang developmentĀ by giving you fast, flexible, and framework-agnostic WebSocket capabilities.


šŸ”Œ What Is SocketBox?

SocketBox is a lightweight WebSocket listener library that runs inside:

  • CommandBox Web Server
  • BoxLang MiniServer

It isn't a separate server — instead, itĀ upgradesĀ a request on theĀ same port.

This means:

  • No extra infrastructure
  • Real-time messages delivered through your existing BoxLang or CFML request pipeline
  • Full access to cookies, headers, sessions, hostnames — all available through standard CGI variables 🧩

At the core, your app receives WebSocket messages through an internal request to:

/WebSocket.cfc?method=onProcess

You then build your logic inside a customĀ WebSocket.cfcĀ (orĀ .bx) by extending SocketBox’s classes.


šŸ’” Why SocketBox Matters for BoxLang Developers

SocketBox gives BoxLang apps:

  • Real-time capabilities
  • Low-level control when needed
  • Optional STOMP message routing when you need advanced messaging
  • A unified WebSocket experience acrossĀ Lucee,Ā Adobe CF, andĀ BoxLang

All usingĀ the same integration layer — making your WebSocket code portable across engines.

Fewer surprises. More consistency. ✨


🧱 Two Ways to Use SocketBox

SocketBox offersĀ two modesĀ depending on how advanced your real-time logic needs to be.


1ļøāƒ£ Core WebSocket Mode — Simple & Direct

This is the lightweight, low-level mode ideal when you want total control.

You get callbacks for:

onConnect( channel )
onClose( channel )
onMessage( message, channel )

And utilities like:

sendMessage( message, channel )
broadcastMessage( message )
getAllConnections()

Example: Ping-Pong Handler

function onMessage( required message, required channel ) {
    if ( message == "Ping" ) {
        sendMessage( "Pong", channel );
    }
}

Perfect for custom logic, games, live alerts, or when you want to define your own protocol.

No magic — just raw power ⚔.


2ļøāƒ£ STOMP Broker Mode — Enterprise Messaging

When you need authentication, routing, topics, fanouts, wildcards, heartbeats, and subscriptions —

the STOMP mode is your friend.

Extend:

modules.socketbox.models.WebSocketSTOMP

This unlocks:

  • šŸ” Authentication & authorization hooks
  • 🧭 Topic routing, exchanges, subscription management
  • šŸ«€ Heartbeats & reconnection logic
  • 🧩 Server-side listeners
  • šŸ“¦ JSON message handling

You can even configure your own message exchanges:

  • .direct
  • .topic
  • .fanout
  • .distribution
  • Or custom CFC exchanges

The STOMP broker provides message semantics similar to modern messaging platforms but fully embedded insideĀ CommandBox + BoxLang.


āš™ļø Browser Usage Example

Core WS Example

<script>
  const socket = new WebSocket('ws://localhost/ws');

  socket.onopen = () => socket.send("Hello from the browser!");
  socket.onmessage = e => console.log("Server:", e.data);
</script>

STOMP Example

import { Client } from '@stomp/stompjs';

const client = new Client({
  brokerURL: 'ws://localhost/ws',
  heartbeatIncoming: 10000,
  heartbeatOutgoing: 10000
});

client.activate();
</script>

WebSockets are fully accessible for modern frontend stacks — React, Vue, Svelte, and even Alpine.js.


šŸŽÆ Why BoxLang + SocketBox is a Big Deal

BoxLang already brings:

  • A modern, JVM-powered language
  • Multi-runtime support
  • Native CFML compatibility
  • Fast startup and flexible deployment

AddingĀ SocketBoxĀ gives BoxLang real-time superpowers:

✨ Build dashboards

✨ Push notifications

✨ Live collaboration tools

✨ Multiplayer features

✨ Monitoring interfaces

✨ IoT / streaming integrations

With zero extra servers — just CommandBox or the MiniServer.


šŸ“š Learn More & Explore


šŸŽ Day 3 Summary

BoxLang + SocketBoxĀ delivers a modern, flexible, and production-ready WebSocket layer perfect for real-time applications.

Whether you're building small prototype tools or enterprise messaging systems, SocketBox gives you both simplicity and power — all running inside the BoxLang ecosystem.

More Christmas goodies coming tomorrow šŸŽ„šŸ˜‰


Want to Join the BoxLang Modern World?

Become a Pioneer

BoxLang is growing fast features are expanding, the ecosystem is thriving, and performance is turning heads. But the most exciting part? You can be part of shaping it from the very beginning.

The Pioneer Program is your gateway to early access, unmatched support, and unbeatable value. Here’s what you get:

  1. Everything in BoxLang+, and more:
    • Professional support to get you running smoothly
    • A dedicated Slack channel for direct access to our team, solve issues in seconds
    • Priority handling for your feature requests and bug fixes
  2. Migration done with you, not just for you:
    • Our engineers work alongside your team to migrate your apps end-to-end
    • Guaranteed compatibility, we won’t stop until it works perfectly
  3. Big savings, no hidden tricks:
    • At least 40% off your current licensing costs, locked in early, no surprise charges as you grow

Contact Us


Still Not Convinced?

If you’re unsure how BoxLang will work with your applications, or whether it can truly make a difference, we’ve made it easy to see the value for yourself, risk-free:

  1. Free 30-Minute Consultation & App Diagnosis

    We’ll review your applications, identify bottlenecks, and give you a clear modernization plan. You’ll see exactly where you can save time, reduce costs, and unlock new possibilities with BoxLang.

  2. 1-Year Free Non-Production License

    Test-drive BoxLang Premium features in your own environment, no rush, no pressure. Explore advanced capabilities, experiment freely, and experience the benefits firsthand before making any commitments.

Request Info


Join the BoxLang Community

Stay connected with the latest updates, BoxLang announcements, Into the Box 2026 news, tutorials, tools, and more.

Subscribe to our newsletterĀ for exclusive updates and early access.

Follow Us

Add Your Comment

Recent Entries

Coming Soon:  Version 4 Docker CommandBox Images with Enhanced Performance

Coming Soon: Version 4 Docker CommandBox Images with Enhanced Performance

CommandBox Docker images were the first CFML docker images and have nearly 2 million pulls, since their inception, to date. It's been a source of pride at Ortus that these images have been the most popular and reliable way to run CFML in containers and we are so very pleased to announce the next evolution, which will be the v4 images which run entirely on the BoxLang CLI and represent a significant overhaul of the image architecture.

These images are now available to test by appending -snapshot to your existing version tags and wil be released as stable, once CommandBox v6 emerges from release candidate status and is published as stable.

Jon Clausen
Jon Clausen
October 30, 2026
Free observability with BxMCP: give your AI agents eyes inside a live BoxLang runtime

Free observability with BxMCP: give your AI agents eyes inside a live BoxLang runtime

Ortus Solutions today announces that bx-mcp, the Model Context Protocol (MCP) server for BoxLang, is now free for everyone. Install it, point any MCP capable client at it, and your AI coding assistant, IDE agent or automation pipeline can inspect and operate a live BoxLang runtime: JVM, caches, datasources, slow requests, schedulers, logs and more. No BoxLang+ subscription required.

Luis Majano
Luis Majano
October 29, 2026
Inherited a CFML Application With Few Tests? Here’s Where to Start!

Inherited a CFML Application With Few Tests? Here’s Where to Start!

You need to change an application that has been running for years.

It might be a ColdFusion customer portal, a Lucee application supporting internal operations, or a CFML system your team is preparing to modernize. People depend on it, but some of its behavior lives in old tickets, scattered documentation, and the memory of whoever has supported it longest.

Now a release is approaching. You know more testing would help. The difficult part is deciding where to begin without putting every other priority on hold.

Start with one important workflow and build evidence around what it needs to do.

Explore Ortus Quality Assurance Services

Maria Jose Herrera
Maria Jose Herrera
October 27, 2026