Skip to main content

Install events-into-websocket plugin into headless wallet

Goal

This article will guide you to install the events-into-websocket plugin in Hathor headless wallet.

The events-into-websocket plugin is part of the external notification feature. To know more about this feature, see Hathor external notifications.

Requirement

Hathor headless wallet \ge v0.19.0

Step-by-step

  1. Install dependency.
  2. Configure and enable the plugin.

Step 1: install dependency

  1. Open the command line from the directory where you installed Hathor headless wallet.
  2. Run the command to install the dependency:
npm install ws@^8.11.0

Step 2: configure and enable the plugin

If you installed Hathor headless wallet from source code, you must modify both the src/config.js file and the command to start the application, to respectively enable and configure the plugin:

  1. Open the command line from the directory where you installed Hathor headless wallet.
  2. Open the src/config.js file.
  3. Add 'ws' to the array of values of the enabled_plugins property to enable the plugin.

If you are enabling multiple plugins, value shall be an array of plugin ids: enabled_plugins: ['PluginId1', 'PluginId2', ...].

At the end of this substep, the config.js file will be as follows:

hathor-wallet-headless/src/config.js
module.exports = {

...

enabled_plugins: ['ws'],

plugin_config: {},

...

};

Note that the events-into-websocket plugin runs a websocket server along with Hathor headless wallet.

  1. Choose the port you want the websocket clients to connect.
  2. To start the wallet application, append the --plugin_ws_port <websocket_server_chosen_port> parameter, replacing the <websocket_server_chosen_port> placeholder with your chosen port.

At the end of this step, the command to start the wallet application will be as follows:

npm start -- --plugin_ws_port <websocket_server_chosen_port>

Task completed

You have installed the events-into-websocket plugin in your instance of Hathor headless wallet and are now running a websocket server that will send all events to all its connected websocket clients.

The events-into-websocket plugin is part of the external notification feature. To know how to use this plugin or install other plugins of this feature, see Hathor external notifications.