A lightweight script for forwarding messages between Redis channels — perfect for bridging systems like Minecraft chat plugins across servers.
RedisChannelForwarding is a simple Node.js script powered by ioredis that listens to one Redis channel and republishes parsed and formatted messages to another channel.
- Forward messages between Redis channels with minimal setup
- Bridge chat between incompatible Minecraft plugins or servers
- Build quick Redis-based message forwarding between microservices
I personally use it in my Minecraft server network to connect two different chat plugins.
ioredisversion 5.6.1 or higher
npm install ioredisUpdate the connection config in rcf.js:
const redisSub = new Redis({
host: 'your-redis-host',
port: 6379,
password: 'your-password'
});
const redisPub = new Redis({
host: 'your-redis-host',
port: 6379,
password: 'your-password'
});node rcf.jsExample: Minecraft Chat Messages
- Subscribes to a source Redis channel (e.g.,
channel1) - Parses incoming messages (typically Minecraft JSON chat format)
- Extracts the player name, UUID, and chat content
- Builds a new structured message with hover/click events
- Publishes it to the target channel (
channel2) for each defined target server (e.g.,server1,server2,server3)
Each forwarded message includes:
fromServer: the source server namefromPlayerUUID: sender UUIDmessage: Minecraft JSON chat format, with hover/click eventstoMCServer: target server nametype: always"PUBLIC_MESSAGE"
The script includes error handling for:
- Invalid JSON structures
- Message parsing failures
- Unexpected format issues
Errors are logged to the console without crashing the script.
RedisChannelForwarding/
├── rcf.js # Main forwarding script
├── README.md # This file
└── package.json # Dependency definitions