Skip to content

Commit 6bae6de

Browse files
committed
update README.md
1 parent 65b532f commit 6bae6de

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

README.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Tracy Re;pader
2-
Tracy extension for automatic page update. Support for Server-sent Events and LiveReload.
1+
# Tracy Reloader
2+
Tracy extension for automatic page live update (LiveReload) or refresh (LiveReload and SSE).
33

44
## Installation
55
```
@@ -17,45 +17,58 @@ tracy:
1717

1818
## Config
1919

20-
Extension supports 2 modes: `LiveReload` or `Server-sent Events`
20+
Extension supports 2 modes: `LiveReload` or `Server Sent Events`
2121

2222
### LiveReload
2323

2424
```php
2525
// minimal setup
26-
Common\Tracy\ReloadPanel('LR', [
27-
// these are default values
28-
'https' => false,
29-
'host' => null, // if null, will be set automatically by current domain
26+
Common\Tracy\ReloadPanel('LR', [
27+
'https' => false, // when accessing LiveReload server from https host
28+
'host' => null, // when NULL, pick visited hostname
3029
'port' => 35729,
31-
'path' => 'livereload'
30+
'path' => 'livereload',
31+
// internal
32+
'excludeHeaders' => [], // additional header definition for AJAX requests exclusion
3233
]);
3334
```
3435

3536
### Server-sent Events
3637

37-
Connects to SSE endpoint (provided in the extension) and watch specified directories and (or) files. Uses `Nette\Utils\Finder` under the hood, so you can setup Finder according to your needs.
38+
Connects to SSE endpoint (provided in the extension out of the box) and watch specified directories and (or) files. Uses `Nette\Utils\Finder` under the hood, so you can setup Finder according to your needs.
3839

3940
Second section - marked `internal` is related to SSE itself. It's kind of selfexplanatory.
4041

4142
```php
4243
// minimal setup
4344
Common\Tracy\ReloadPanel('SSE', [
44-
// Finder
45+
// Nette\Utils\Finder config
4546
'mask' => '*.*',
4647
'in' => null,
4748
'from' => null,
4849
'exclude' => null,
4950
'excludeDir' => null,
5051
// internal
51-
'timeout' => 30, // every script runs only for 30 seconds
52-
'refreshRate' => 30,
53-
'watchInterval' => 2,
52+
'excludeHeaders' => [], // additional header definition for AJAX requests exclusion
53+
'timeout' => 30, // SSE/Reloader.php max execution time
54+
'watchInterval' => 2, // loop sleep interval
5455
]);
5556
```
5657

57-
### ExcludeHeaders
58+
### Filter ajax requests
59+
60+
It is not desired to render tracy panel for AJAX requests. Basic AJAX requests are filtered out automatically, but if you send some additional AJAX requests, you can filter them out by specifying headers that are related to these requests.
5861

59-
Additional check for request for which extension should return nothing. Basically extension should not render for AJAX requests. Because on every render it connects to LiveReload/SSE endpoint and that's not wanted on ajax requests.
62+
These headers should be specified in `excludedHeaders` property of `$config` as `$key: $value` pairs.
6063

61-
Provide any `key => value` pair for additional headers, which signal AJAX request.
64+
Example of `local.neon`:
65+
```
66+
tracy:
67+
bar:
68+
- Mskocik\TracyReloader\ReloaderPanel('LR', [
69+
https: true,
70+
excludeHeaders: [
71+
x-requested-with: swup
72+
]
73+
])
74+
```

0 commit comments

Comments
 (0)