diff options
author | Valery Piashchynski <[email protected]> | 2021-05-29 00:24:30 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-05-29 00:24:30 +0300 |
commit | fcda08498e8f914bbd0798da898818cd5d0e4348 (patch) | |
tree | 62d88384d07997e2373f3b273ba0cb83569ebced /plugins/http/plugin.go | |
parent | 8f13eb958c7eec49acba6e343edb77c6ede89f09 (diff) |
- Add new internal plugin - channel. Which used to deliver messages from
the ws plugin to the http directly
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/http/plugin.go')
-rw-r--r-- | plugins/http/plugin.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go index 8bcffb63..38b3621f 100644 --- a/plugins/http/plugin.go +++ b/plugins/http/plugin.go @@ -14,6 +14,7 @@ import ( "github.com/spiral/roadrunner/v2/pkg/process" "github.com/spiral/roadrunner/v2/pkg/worker" handler "github.com/spiral/roadrunner/v2/pkg/worker_handler" + "github.com/spiral/roadrunner/v2/plugins/channel" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/plugins/http/attributes" httpConfig "github.com/spiral/roadrunner/v2/plugins/http/config" @@ -67,11 +68,14 @@ type Plugin struct { http *http.Server https *http.Server fcgi *http.Server + + // message bus + hub channel.Hub } // Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of // misconfiguration. Services must not be used without proper configuration pushed first. -func (p *Plugin) Init(cfg config.Configurer, rrLogger logger.Logger, server server.Server) error { +func (p *Plugin) Init(cfg config.Configurer, rrLogger logger.Logger, server server.Server, channel channel.Hub) error { const op = errors.Op("http_plugin_init") if !cfg.Has(PluginName) { return errors.E(op, errors.Disabled) @@ -105,6 +109,9 @@ func (p *Plugin) Init(cfg config.Configurer, rrLogger logger.Logger, server serv p.cfg.Env[RrMode] = "http" p.server = server + p.hub = channel + + go p.messages() return nil } |