interactive-solutions / zf-hermes
Interactive Solutions extension for Node Hermes
Installs: 159
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/interactive-solutions/zf-hermes
Requires
- php: >=7.0.0
- container-interop/container-interop: ^1.1
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2025-04-05 04:49:42 UTC
README
Zend Framework module to work with Node-Hermes.
Configuration
Copy the hermes.global.php.dist to change the default Redis configuration.
Default values are:
host = 'localhost'port = 6379
Usage
Just inject the NotifierService and use publish to send a message over Redis.
// $this->notifierService is an injected NotifierService $this->notifierService->publish($message);
$message must be an object implementing the MessageInterface.
The message interface consists of the following properties:
channelRedis channel to publish to message ontouserIdId of the user that triggered the Redis eventtimeStampThe timestamp of when the message was createdpayloadAdditional data to be sent
The notifier service sends a json encoded message consisting of the
properties userId, timeStamp and payload onto Redis channel channel.
Note that the channel property is not part of the message.
Recommendations
It is recommended to use listeners to listen for events that should generate a Redis message. Although it is possible to inject the notifier service directly into another class.