Redix LogoDocumentation
API ReferencePub/Sub

Overview

Redis Pub/Sub (Publish/Subscribe) is a messaging paradigm where publishers send messages to channels without knowing who or if anyone will receive them. Subscribers express interest in one or more channels and receive all messages published to those channels. Perfect for real-time events, cross-resource communication, and multi-server synchronization.

Available Operations

Channel Operations

Pattern Operations

Use Cases

  • Cross-resource communication
  • Multi-server synchronization
  • Real-time notifications
  • Chat systems
  • Event broadcasting
  • Live leaderboard updates

Quick Example

local Redix = exports.redix:GetInterface()

-- Subscribe to events
Redix.Subscribe('events:player', function(message)
    local data = json.decode(message)
    HandleEvent(data)
end)

-- Publish event
local event = json.encode({
    type = 'join',
    playerId = playerId
})
Redix.Publish('events:player', event)