File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
require dirname (__DIR__ ) . DIRECTORY_SEPARATOR . 'vendor/autoload.php ' ;
9
9
10
- $ display = function ($ event ) {
11
- echo 'Channel: ' , $ event ['channel ' ], PHP_EOL ;
12
- echo 'Event: ' , $ event ['event ' ], PHP_EOL ;
13
- echo 'Data: ' , $ event ['data ' ], PHP_EOL ;
14
- };
15
-
16
10
$ loop = Factory::create ();
17
11
18
12
/**
24
18
$ subReddits = $ argv ;
25
19
array_shift ($ subReddits );
26
20
foreach ($ subReddits as $ subReddit ) {
27
- $ client ->subscribe ($ subReddit )->subscribe (new CallbackObserver ($ display ));
21
+ $ client ->subscribe ($ subReddit )->subscribe (new CallbackObserver (function ($ event ) {
22
+ echo 'Channel: ' , $ event ['channel ' ], PHP_EOL ;
23
+ echo 'Event: ' , $ event ['event ' ], PHP_EOL ;
24
+ echo 'Data: ' , $ event ['data ' ], PHP_EOL ;
25
+ }));
28
26
}
29
27
30
28
$ loop ->run ();
You can’t perform that action at this time.
0 commit comments