You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,11 @@ class RoboFile extends Tasks
87
87
88
88
public function someTask()
89
89
{
90
+
$this
91
+
->taskLiveReload()
92
+
->run();
93
+
94
+
// Further down...
90
95
$this
91
96
->taskLiveReload()
92
97
->sendReloadMessage();
@@ -97,6 +102,31 @@ class RoboFile extends Tasks
97
102
This will send a "reload" message to the Live Reload server. If you load the `livereload.js` file created by the task, your browser will automatically reload when this message is received.
98
103
Typically, you will use this method when using a "watch" behavior so a reload can be triggered after your watch handler has been executed.
99
104
105
+
If you want to send another message to extend the behavior of the Live Reload server, you can have access to the WebSocket client using the `getWsClient()` method and send the message you want :
106
+
107
+
```php
108
+
use Elephfront\RoboLiveReload\Task\Loader\LoadLiveReloadTaskTrait;
109
+
110
+
class RoboFile extends Tasks
111
+
{
112
+
113
+
use LoadLiveReloadTaskTrait;
114
+
115
+
public function someTask()
116
+
{
117
+
$this
118
+
->taskLiveReload()
119
+
->run();
120
+
121
+
// Further down...
122
+
$this
123
+
->taskLiveReload()
124
+
->getWsClient()
125
+
->send('your-message');
126
+
}
127
+
}
128
+
```
129
+
100
130
## Contributing
101
131
102
132
If you find a bug or would like to ask for a feature, please use the [GitHub issue tracker](https://github.com/Elephfront/robo-live-reload/issues).
0 commit comments