@@ -99,12 +99,12 @@ $factory = new Factory($loop, $connector);
9999
100100#### createClient()
101101
102- The ` createClient(string $amiUrl ): PromiseInterface<Client> ` method can be used to create a new [ ` Client ` ] ( #client ) .
103- It helps with establishing a plain TCP/IP or secure SSL/ TLS connection to the AMI
104- and issuing an initial ` login ` action.
102+ The ` createClient(string $url ): PromiseInterface<Client> ` method can be used to create a new [ ` Client ` ] ( #client ) .
103+ It helps with establishing a plain TCP/IP or secure TLS connection to the AMI
104+ and optionally issuing an initial ` login ` action.
105105
106106``` php
107- $factory->createClient($amiUrl )->then(
107+ $factory->createClient($url )->then(
108108 function (Client $client) {
109109 // client connected (and authenticated)
110110 },
@@ -114,16 +114,18 @@ $factory->createClient($amiUrl)->then(
114114);
115115```
116116
117- The ` $amiUrl ` contains the host and optional port to connect to:
117+ The method returns a [ Promise] ( https://github.com/reactphp/promise ) that will
118+ resolve with the [ ` Client ` ] ( #client ) instance on success or will reject with an
119+ ` Exception ` if the URL is invalid or the connection or authentication fails.
120+
121+ The ` $url ` parameter contains the host and optional port (which defaults to
122+ ` 5038 ` for plain TCP/IP connections) to connect to:
118123
119124``` php
120- $factory->createClient('127.0.0.1 :5038');
125+ $factory->createClient('localhost :5038');
121126```
122127
123- > If the ` $amiUrl ` is ` null ` (or omitted) this method defaults to connecting
124- to your local host (` 127.0.0.1:5038 ` ).
125-
126- The above examples to not pass any authentication details, so you may have to
128+ The above example does not pass any authentication details, so you may have to
127129call ` ActionSender::login() ` after connecting or use the recommended shortcut
128130to pass a username and secret for your AMI login details like this:
129131
@@ -132,10 +134,11 @@ $factory->createClient('user:secret@localhost');
132134```
133135
134136The ` Factory ` defaults to establishing a plaintext TCP connection.
135- If you want to connect through a secure TLS proxy, you can use the ` tls ` scheme:
137+ If you want to create a secure TLS connection, you can use the ` tls ` scheme
138+ (which defaults to port ` 5039 ` ):
136139
137140``` php
138- $factory->createClient('tls://user:secret@localhost:12345 ');
141+ $factory->createClient('tls://user:secret@localhost:5039 ');
139142```
140143
141144### Client
0 commit comments