Skip to content

Conversation

@konard
Copy link
Owner

@konard konard commented Oct 17, 2025

🔧 Fix: Replace Dead PubNub Twitter Stream with Live WebSocket Data

📋 Issue Reference

Fixes #8

🔍 Problem Analysis

The application stopped working because the PubNub Twitter stream (pubnub-twitter channel) is no longer functional. This is due to:

  1. Twitter API Changes (Feb 2023): Twitter/X ended free API access in February 2023, moving to a paid tier-only model
  2. PubNub Demo Stream: The PubNub Twitter stream was a demo service that relied on Twitter's free API, which is no longer available
  3. Impact: Both index.html and messages.html were unable to receive real-time data, rendering the matrix visualization non-functional

✅ Solution Implemented

Replaced the deprecated PubNub Twitter stream with a free, actively maintained WebSocket stream from Quixio's real-time-data-sources:

WebSocket URL: wss://ai-chat-wss-demo-realtimedatasources-prod.deployments.quix.io/timeseries

Data Source: Real-time AI-generated customer support chat conversations (using Llama2 AI agents)

📝 Changes Made

1. index.html

  • ✅ Removed PubNub SDK dependency
  • ✅ Replaced PUBNUB.init() with native WebSocket API
  • ✅ Updated message handling to parse WebSocket JSON format
  • ✅ Added reconnection logic (auto-reload after 5 seconds on disconnect)
  • ✅ Maintained original visual effect and character rendering

2. messages.html

  • ✅ Removed PubNub SDK dependency
  • ✅ Replaced PUBNUB.init() with native WebSocket API
  • ✅ Updated message queue from twitterMessages to chatMessages
  • ✅ Added reconnection logic (auto-reload after 5 seconds on disconnect)
  • ✅ Maintained all original features (speed adjustment, mouse interaction, clickable columns)
  • ✅ Preserved language filtering capability

🎯 Benefits

  1. Working Data Stream: Application now receives real-time data again
  2. No External Dependencies: Removed PubNub SDK, using native WebSocket API
  3. Free & Reliable: Quixio provides a free public stream for demos
  4. Better Resilience: Added automatic reconnection on disconnect
  5. Same Visual Experience: Users see the same Matrix-style falling text effect

🧪 Testing

Created test utilities in experiments/ folder:

  • test_websocket.html - Simple WebSocket connection test
  • test_server.py - Local HTTP server for testing

To test locally:

cd /path/to/repo
python3 experiments/test_server.py
# Open http://localhost:8000/index.html or http://localhost:8000/messages.html

📊 Technical Details

WebSocket Message Format:

{
  "timestamps": [1234567890],
  "stringValues": {
    "chat": ["Customer message text here"],
    "conversation_id": ["conv_123"],
    "role": ["customer"]
  }
}

The implementation extracts chat text from stringValues and converts it to Unicode symbols using the existing getSymbols() function, maintaining compatibility with the original visualization logic.

🚀 Deployment

No special deployment steps required. The changes work with any static file hosting since WebSocket connections are made client-side.


🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 17, 2025
@konard konard changed the title [WIP] It's not working Fix: Replace dead PubNub Twitter stream with live WebSocket data source Oct 17, 2025
- Twitter/X ended free API access in Feb 2023, breaking PubNub demo stream
- Replaced with Quixio's free AI chat WebSocket stream
- Removed PubNub SDK dependency, using native WebSocket API
- Added automatic reconnection logic (5s delay on disconnect)
- Created test utilities in experiments/ folder
- Maintains original Matrix visual effect and all features

WebSocket: wss://ai-chat-wss-demo-realtimedatasources-prod.deployments.quix.io/timeseries
Data source: https://github.com/quixio/real-time-data-sources

Fixes #8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@konard konard marked this pull request as ready for review October 17, 2025 16:01
@konard konard mentioned this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

It's not working

2 participants