A server implementing the Mercure SSE specification
Go to file
2024-03-12 18:20:56 +01:00
bin Fixes to ssl/tls, misc improvements 2024-03-12 15:51:55 +01:00
doc Configuration fixes, makefile tweaks 2024-03-12 01:13:19 +01:00
src Fixes to ssl/tls, misc improvements 2024-03-12 15:51:55 +01:00
tests/Broker Update makefile, tweak topictest 2024-03-12 18:20:56 +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 Update makefile, tweak topictest 2024-03-12 18:20:56 +01:00
mercureactd.conf.dist Fixed dist conf 2024-03-12 16:00:15 +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