Skip to content

Conversation

jlledom
Copy link
Contributor

@jlledom jlledom commented Aug 19, 2025

This PR adds a helper in Enpoint to connect to Redis through a unix socket. The implementation supports receiving options like credentials. I tested the connection to an ACL protected server through a Unix socket and it works fine for me.

This is the script I used to test the branch locally:

# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  #gem 'async-redis'
  gem 'async-redis', git: 'https://github.com/jlledom/async-redis', branch: 'jlledom-unix-endpoint'
end

def main
  Async do
    path= '/path/to/acl-redis-master.sock'
    credentials = %w[user passW0rd]
    endpoint = Async::Redis::Endpoint.unix(path, credentials:)
    client = Async::Redis::Client.new(endpoint)

    while true
      begin
        sleep 1
        result = client.ping 'test'
        puts result
      rescue StandardError => e
        puts e.message
        retry
      end
    end
  end
end

main

Types of Changes

  • New feature.

Contribution

@ioquatix ioquatix merged commit 23c1c90 into socketry:main Sep 20, 2025
16 of 21 checks passed
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.

2 participants