A server implementing the Mercure SSE specification
Go to file
Christopher Vagnetoft da450b510a Updated dependencies, improved config
* Configuration now key-value map with friendly accessors.
* Configuration file maps 1:1
2024-03-12 00:28:31 +01:00
bin Updated dependencies, improved config 2024-03-12 00:28:31 +01:00
doc Initial commit 2024-03-10 03:06:19 +01:00
src Updated dependencies, improved config 2024-03-12 00:28:31 +01:00
.gitignore Initial commit 2024-03-10 03:06:19 +01:00
composer.json Initial config file parsing logic 2024-03-11 02:15:04 +01:00
composer.lock Updated dependencies, improved config 2024-03-12 00:28:31 +01:00
LICENSE Initial commit 2024-03-10 03:06:19 +01:00
Makefile Fixed topic gc bug 2024-03-11 01:40:05 +01:00
mercureactd.conf.dist Updated dependencies, improved config 2024-03-12 00:28:31 +01:00
phpstan.neon Misc fixes, readme, comments 2024-03-10 16:23:46 +01:00
phpunit.xml Initial config file parsing logic 2024-03-11 02:15:04 +01:00
README.md Config stuff, docs 2024-03-11 23:20:48 +01:00

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 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.

# 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
    • Setup subscriptions
    • Dynamic subscriptions
    • Distribute events over WS
  • HTTP middleware unittests
  • Replay missed events based on event id
  • Metrics endpoint