46 lines
1.6 KiB
Markdown
46 lines
1.6 KiB
Markdown
# Mercureact
|
|
|
|
This is an implementation of the Mercure realtime protocol, built using ReactPHP. It is intended to be used standalone, but it may also be integrated into another ReactPHP application.
|
|
|
|
**Mercureact is under development, and not ready for use in anything important.**
|
|
|
|
## Installing
|
|
|
|
As PHAR:
|
|
|
|
* Download the latest [release](/noccy/mercureact/releases) from the forge.
|
|
|
|
As Composer dependency:
|
|
|
|
* `composer require noccylabs/mercureact:@dev`
|
|
|
|
## Using as PHAR
|
|
|
|
Running `mercureact.phar` without passing a config file with `-c` will spawn an insecure daemon that can be used for testing. Following tradition, the default JWT secret key is `!ChangeThisMercureHubJWTSecretKey!`; this key must be used to publish, but anonymous subscribers are allowed, and will be delivered any non-private updates.
|
|
|
|
You should probably use a configuration file for just about every case. Mercureact contains a compact dist config that can be written to a file with `-C`, or you can use the `mercureact.conf.dist` file from the repository.
|
|
|
|
```shell
|
|
# If you got a mercureact.conf.dist file, make a copy and edit it
|
|
$ cp mercureact.conf.dist mercureact.conf
|
|
$ editor mercureact.conf
|
|
|
|
# Or use the -C (capital C) option to generate and edit one
|
|
$ ./mercureact.phar -C mercureact.conf
|
|
|
|
# Then use the config file when launching
|
|
$ ./mercureact.phar -c mercureact.conf
|
|
```
|
|
|
|
## Using as dependency
|
|
|
|
Take a look at `src/Daemon.php` and `src/Http/Server.php` depending on how much of Mercureact you want to reuse.
|
|
|
|
## ToDos
|
|
|
|
* [ ] WebSocket distributor
|
|
* [ ] WebSocket authentication
|
|
* [ ] HTTP middleware unittests
|
|
* [ ] Replay missed events based on event id
|
|
* [ ] Metrics endpoint
|