This repository contains the demonstration code from the "Mastering WebSockets with ColdFusion" presentation delivered at Adobe ColdFusion Summit 2024 and 2025.
This demo showcases various WebSocket implementation patterns in ColdFusion, from basic chat applications to advanced features like authentication, channel listeners, and debugging strategies.
- Setting up ColdFusion WebSocket applications
- Implementing real-time chat functionality
- Using channel listeners for advanced message handling
- Authentication and authorization with WebSockets
- Debugging WebSocket connections and messages
- Server-side message publishing
- Client-side connection management
- Adobe ColdFusion 2025+ (or compatible version)
- CommandBox CLI (recommended)
- Modern web browser with WebSocket support
- Clone this repository:
git clone git@github.com:GiancarloGomez/ColdFusion-Mastering-WebSockets.git
cd ColdFusion-Mastering-WebSockets- Install dependencies using CommandBox:
box install- Start the server:
box startCommandBox will automatically choose available ports and display the URLs where your application is accessible.
Application.cfc- Main application configuration with WebSocket channel setupindex.cfm- Basic WebSocket chat interfacestatic.html- Pure JavaScript WebSocket implementation example
advanced.cfm- Advanced WebSocket features with AdvancedSocket librarybroadcast.cfm- Server-side message broadcastingjoke.cfm- Demo endpoint that publishes random jokesping.cfm- Connection health checking endpointsubscribers.cfm- View active WebSocket subscribers
ProtectedChannelListener.cfc- Advanced channel with authentication and message filtering
assets/app.js- Client-side WebSocket handlingassets/app.css- Styling for the demo interfacesassets/subscriber-examples.js- Code examples for different subscription patterns
The application defines several channels in Application.cfc:
this.wschannels = [
{ name:"dashboard" },
{ name:"demo" },
{ name:"console" },
{ name:"protected", cfclistener:"ProtectedChannelListener" }
];WebSocket authentication is handled in the onWSAuthenticate function with these test credentials:
- admin / system
- employee / password
- hr / 1234567
Simple WebSocket chat interface demonstrating:
- Real-time messaging
- Client identification
- Message history
Pure JavaScript WebSocket implementation showing:
- Direct WebSocket API usage
- Protocol handling (ws/wss)
- Manual connection management
Enhanced WebSocket functionality including:
- Automatic reconnection
- Connection health monitoring
- Advanced message routing
Demonstrates:
- User authentication
- Message filtering
- Custom channel listeners
/subscribers.cfm- View all active subscribers and channels/ping.cfm- Check client connection status, used by AdvancedSocket/console/- WebSocket debugging console (if installed)
- Various subscriber examples in
assets/subscriber-examples.js
- Channel Management - Creating and managing WebSocket channels
- Authentication - Securing WebSocket connections
- Message Filtering - Using selectors and properties for targeted messaging
- Connection Monitoring - Health checks and reconnection strategies
- Server Publishing - Broadcasting messages from server-side code
- Client Libraries - Using both native WebSocket API and enhanced libraries
- Presentation Slides
- Adobe ColdFusion WebSocket Documentation
- ๐น๏ธ Interactive Game Demo
Game used at the end of the presentation
This is a demonstration repository. Feel free to fork and experiment with the code for your own learning purposes.
This demo code is provided for educational purposes.
Note: This code is designed for demonstration and learning purposes. For production use, ensure proper error handling, security measures, and testing are implemented.