Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 1.02 KB

README.md

File metadata and controls

66 lines (42 loc) · 1.02 KB

Simple WebSocket Server

A simple WebSocket server that sends Bitcoin data to the client every 5 seconds.

Features

Get from coibase.com:

API WebSocket connection.

  • Bitcoin Price

Get from mempool.space:

API REST connection.

  • Last block hegith
  • Medium fee

Setup

  1. Use the Node.js version specified in the .nvmrc file. (Install it if you don't have it installed yet.)

    nvm use
  2. Install the dependencies.

    pnpm install
  3. Run the server.

     pnpm dev

Conection

From your client, connect to the WebSocket server and send a message to subscribe it.

Subscribing message:

{ "action": "want" }

Responses:

  • Successfull message:

    Subscribte to the WebSocket server!
    
  • Data every 5 seconds:

    {
    	"lastBlock": <string>,
    	"price": <string>,
    	"mediumFee": <string>
    }