Skip to content

rapax00/bitcoin-ticker-ws-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>
    }