Skip to main content
Version: Next

Code Snippets for HOPR Apps

Most HOPR applications require to do at least one of the following actions:

  • Send commands to a HOPR node REST API via an Authenticated request
  • Connect to a WebSocket HOPR and listen to responses sent there
  • Prompt users for the HOPR node HTTP and WebSocket endpoints and API token

Since these actions are usually cumbersome, we have generated a few code snippets developers can copy and paste to execute most of these actions quickly. These snippets will eventually be included in an SDK1, but for the time being, having them here is the easiest and fastest way for anyone to get started.


useWebSocket.js

Loading useWebSocket.js


WebSocketHandler.jsx

Loading WebSocketHandler.jsx


getHeaders.js

Loading getHeaders.js


  1. To get updates on the progress of our SDK, please subscribe to this issue.