Skip to content

Added example for connecting to unix socket #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ You can use the [standard](https://www.iana.org/assignments/uri-schemes/prov/red
$factory->createClient('rediss://redis.example.com:6340');
```

If you want to connect to redis using a unix socket you can use the [FixedUriConnector](https://github.com/reactphp/socket#fixeduriconnector) to direct the connection to the unix socket.
The host and port in the specified client URL are ignored but you can still configure authentication and database with it.

```php
$connector = new FixedUriConnector('unix:///var/run/redis/redis.sock', new UnixConnector($loop));
$factory = new Factory($loop, $connector);
$factory->createClient('redis://localhost/2');
```

### Client

The `Client` is responsible for exchanging messages with Redis
Expand Down