Skip to content

Commit

Permalink
update readme for ws integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ssd04 committed Oct 2, 2023
1 parent 73a949b commit 283b106
Showing 1 changed file with 14 additions and 35 deletions.
49 changes: 14 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,17 @@ has to setup one or multiple observers. For running an observing squad,
these [docs](https://docs.multiversx.com/integrators/observing-squad/)
cover the whole process.

There observer node can be connected using WebSocket integration. Please check observer
node config for setting up the connector. Enable `HostDriversConfig` in order to use
WebSocket integration.

The required configs for launching an observer/s with a driver attached,
can be found [here](https://github.com/multiversx/mx-chain-go/blob/master/cmd/node/config/external.toml).

The supported config variables are as follows:

- `Enabled`: signals whether a driver should be attached when launching the node.
- `UseAuthorization`: signal whether to use authorization. For testing purposes it can be set to `false`.
- `ProxyUrl`: host and port on which the `eventNotifier` will push the parsed event data.
- `Username`: the username used for authorization.
- `Password`: the password used for authorization.

The corresponding config section for enabling the driver:

```toml
[EventNotifierConnector]
# Enabled will turn on or off the event notifier connector
Enabled = true

# UseAuthorization signals the proxy to use authorization
# Never run a production setup without authorization
UseAuthorization = false

# ProxyUrl is used to communicate with the subscriptions hub
# The indexer instance will broadcast data using ProxyUrl
ProxyUrl = "http://localhost:5000"

# Username and Password need to be specified if UseAuthorization is set to true
Username = ""
The HTTP integration is still available for backwards compatibility, but it will be
deprecated in the future.

# Password is used to authorize an observer to push event data
Password = ""
```

## Install
## How to run

Using the `cmd/notifier` package as root, execute the following commands:

Expand All @@ -62,22 +39,24 @@ make run
make run publisher_type=rabbitmq
```

## Launching the proxy

CLI: run `--help` to get the command line parameters
```bash
./cmd/notifier/event-notifier --help
```

### Prerequisites

Before launching the proxy (notifier) service, it has to be configured so that it runs with the
correct environment variables.
correct config variables.

The main config file can be found [here](https://github.com/multiversx/mx-chain-notifier-go/blob/main/cmd/notifier/config/config.toml).

The supported config variables are:
- `Host`: the host and port on which the http server listens on. Should be the same port
as the one specified in the `ProxyUrl` described above.
- `Username`: the username used to authorize an observer. Can be left empty for `UseAuthorization = false` on observer connector.
- `Password`: the password used to authorize an observer. Can be left empty for `UseAuthorization = false` on observer connector.
- `CheckDuplicates`: if true, it will check (based on a locker service using redis) if the event have been already pushed to clients

If observer connector is set to use BasicAuth with `UseAuthorization = true`, `Username` and `Password` has to be
set here on events notifier, and `Auth` flag has to be enabled in
Expand All @@ -90,15 +69,15 @@ For example:
{ Name = "/revert", Open = true, Auth = false },
```

The main config file can be found [here](https://github.com/multiversx/mx-chain-notifier-go/blob/main/cmd/notifier/config/config.toml).

After the configuration file is set up, the notifier instance can be
launched.

There are multiple publishing options when starting notifier service:
* `ws`: it will launch a websocket handler (check [WebSockets](#websockets) section)
* `rabbitmq`: it will set up a rabbitMQ client based on the RabbitMQ section from main config file (check [RabbitMQ](#rabbitmq) section)

## Development setup

There is a development setup using docker containers (with
docker compose) that can be used for this.

Expand Down

0 comments on commit 283b106

Please sign in to comment.