Skip to content

GiancarloGomez/ColdFusion-Mastering-WebSockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Mastering WebSockets with ColdFusion - Demo Code

This repository contains the demonstration code from the "Mastering WebSockets with ColdFusion" presentation delivered at Adobe ColdFusion Summit 2024 and 2025.

๐Ÿ“‹ Overview

This demo showcases various WebSocket implementation patterns in ColdFusion, from basic chat applications to advanced features like authentication, channel listeners, and debugging strategies.

๐ŸŽฏ What You'll Learn

  • 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

๐Ÿš€ Quick Start

Prerequisites

  • Adobe ColdFusion 2025+ (or compatible version)
  • CommandBox CLI (recommended)
  • Modern web browser with WebSocket support

Installation

  1. Clone this repository:
git clone git@github.com:GiancarloGomez/ColdFusion-Mastering-WebSockets.git
cd ColdFusion-Mastering-WebSockets
  1. Install dependencies using CommandBox:
box install
  1. Start the server:
box start

CommandBox will automatically choose available ports and display the URLs where your application is accessible.

๐Ÿ“ Project Structure

Core Files

  • Application.cfc - Main application configuration with WebSocket channel setup
  • index.cfm - Basic WebSocket chat interface
  • static.html - Pure JavaScript WebSocket implementation example

WebSocket Examples

Channel Listeners

Assets

๐Ÿ”ง Configuration

WebSocket Channels

The application defines several channels in Application.cfc:

this.wschannels = [
    { name:"dashboard" },
    { name:"demo" },
    { name:"console" },
    { name:"protected", cfclistener:"ProtectedChannelListener" }
];

Authentication

WebSocket authentication is handled in the onWSAuthenticate function with these test credentials:

  • admin / system
  • employee / password
  • hr / 1234567

๐ŸŽฎ Demo Features

1. Basic Chat (index.cfm)

Simple WebSocket chat interface demonstrating:

  • Real-time messaging
  • Client identification
  • Message history

2. Static Implementation (static.html)

Pure JavaScript WebSocket implementation showing:

  • Direct WebSocket API usage
  • Protocol handling (ws/wss)
  • Manual connection management

3. Advanced Features (advanced.cfm)

Enhanced WebSocket functionality including:

  • Automatic reconnection
  • Connection health monitoring
  • Advanced message routing

4. Protected Channels

Demonstrates:

  • User authentication
  • Message filtering
  • Custom channel listeners

๐Ÿ› ๏ธ Development Tools

Debugging Endpoints

  • /subscribers.cfm - View all active subscribers and channels
  • /ping.cfm - Check client connection status, used by AdvancedSocket
  • /console/ - WebSocket debugging console (if installed)

Testing Scripts

๐Ÿ“– Key Concepts Demonstrated

  1. Channel Management - Creating and managing WebSocket channels
  2. Authentication - Securing WebSocket connections
  3. Message Filtering - Using selectors and properties for targeted messaging
  4. Connection Monitoring - Health checks and reconnection strategies
  5. Server Publishing - Broadcasting messages from server-side code
  6. Client Libraries - Using both native WebSocket API and enhanced libraries

๐Ÿ”— Resources

Dependency Packages

๐Ÿค Contributing

This is a demonstration repository. Feel free to fork and experiment with the code for your own learning purposes.

๐Ÿ“ License

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.

About

Demo code used for the Mastering WebSockets with ColdFusion: Code Faster, Code Smarter presentation - CF Summit 24 and 25

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors