Skip to content

Commit 9ff1ffc

Browse files
committed
Update README.md
1 parent 6fa1aa1 commit 9ff1ffc

File tree

1 file changed

+13
-47
lines changed

1 file changed

+13
-47
lines changed

README.md

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,20 @@ then run `composer update`.
2929
Use the credentials from your Botika Socket application to create a new `Botika\Socket` instance.
3030

3131
```php
32+
$baseURL = 'https://socket.example.com';
3233
$username = 'USERNAME';
3334
$password = 'PASSWORD';
3435
$auth = new \Botika\Socket\Auth($username, $password);
3536

36-
// Options get from https://docs.guzzlephp.org/en/stable/request-options.html
37-
$options = [];
38-
3937
// Initialize socket
40-
$socket = new \Botika\Socket\Socket($auth, $options);
41-
```
42-
43-
The second parameter is an `$options` array. The additional options get from <https://docs.guzzlephp.org/en/stable/request-options.html>
44-
45-
For example, by default calls will be made over HTTPS. To use plain
46-
HTTP you can set verify to false:
47-
48-
```php
49-
$options = [
50-
'base_uri' => 'https://socket.botika.online',
51-
'verify' => true
52-
];
53-
$socket = new \Botika\Socket\Socket($auth, $options);
38+
$socket = new \Botika\Socket\Socket($baseURL, $auth);
5439
```
5540

5641
## Logging configuration
5742

5843
The recommended approach of logging is to use a
5944
[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
60-
compliant logger implementing `Psr\Log\LoggerInterface`. The `Pusher` object
45+
compliant logger implementing `Psr\Log\LoggerInterface`. The `Socket` object
6146
implements `Psr\Log\LoggerAwareInterface`, meaning you call
6247
`setLogger(LoggerInterface $logger)` to set the logger instance.
6348

@@ -74,13 +59,17 @@ To trigger an event on one or more channels use the `trigger` function.
7459
### A single channel
7560

7661
```php
77-
$socket->trigger('my-channel', 'my_event', 'hello world');
62+
// Options get from https://docs.guzzlephp.org/en/stable/request-options.html
63+
$options = [];
64+
$socket->trigger('my-channel', 'my_event', 'hello world', $options);
7865
```
7966

8067
### Multiple channels
8168

8269
```php
83-
$pusher->trigger([ 'channel-1', 'channel-2' ], 'my_event', 'hello world');
70+
// Options get from https://docs.guzzlephp.org/en/stable/request-options.html
71+
$options = [];
72+
$socket->trigger([ 'channel-1', 'channel-2' ], 'my_event', 'hello world', $options);
8473
```
8574

8675
### Asynchronous interface
@@ -90,7 +79,9 @@ promises](https://github.com/guzzle/promises) which can be chained
9079
with `->then`:
9180

9281
```php
93-
$promise = $socket->triggerAsync(['channel-1', 'channel-2'], 'my_event', 'hello world');
82+
// Options get from https://docs.guzzlephp.org/en/stable/request-options.html
83+
$options = [];
84+
$promise = $socket->triggerAsync(['channel-1', 'channel-2'], 'my_event', 'hello world', $options);
9485
$promise->then(
9586
function (ResponseInterface $res) {
9687
echo $res->getStatusCode() . "\n";
@@ -101,29 +92,4 @@ $promise->then(
10192
}
10293
);
10394
$promise->wait();
104-
```
105-
106-
### Arrays
107-
108-
Arrays are automatically converted to JSON format:
109-
110-
```php
111-
$array['name'] = 'joe';
112-
$array['message_count'] = 23;
113-
114-
$socket->trigger('my_channel', 'my_event', $array);
115-
```
116-
117-
The output of this will be:
118-
119-
```json
120-
"{'name': 'joe', 'message_count': 23}"
121-
```
122-
123-
## License
124-
125-
Copyright 2014, Pusher. Licensed under the MIT license:
126-
<http://www.opensource.org/licenses/mit-license.php>
127-
128-
Copyright 2010, Squeeks. Licensed under the MIT license:
129-
<http://www.opensource.org/licenses/mit-license.php>
95+
```

0 commit comments

Comments
 (0)