A server implementing the Mercure SSE specification
Go to file
2024-03-14 00:45:26 +01:00
bin Request limiting, config improvements 2024-03-13 01:54:28 +01:00
doc Added docs on WebSocket support 2024-03-13 12:40:59 +01:00
src Refactored SubscriberInterface 2024-03-14 00:45:26 +01:00
tests Refactored SubscriberInterface 2024-03-14 00:45:26 +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 Improved response middleware, added tests 2024-03-13 22:20:54 +01:00
mercureactd.conf.dist Request limiting, config improvements 2024-03-13 01:54:28 +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 Refactored subscribers to own namespace 2024-03-14 00:32:44 +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
  • HTTP middleware unittests
  • Replay missed events based on event id
  • Metrics endpoint