Bugfix Websocket hostname. (#21)

* Add yarn-error.log to gitignore.

* Add ts-node to devDependencies.
Add script to only build tsc.
Add websocket to keywords.

* Update yarn.lock libs.

* FIX websocket endpoint hostname.
FIX corrent import for all examples.
FIX websocket instrucions on readme.
This commit is contained in:
Miguel Medeiros
2021-05-20 12:03:40 -03:00
committed by GitHub
parent 0aa3757217
commit e3068c2d8d
28 changed files with 236 additions and 169 deletions

View File

@@ -2,13 +2,13 @@ import { WsInterface, WsInstance } from '../../interfaces/bitcoin/websockets';
import wsClient from '../../services/ws/client';
import wsServer from '../../services/ws/server';
const defaultWs = 'wss://mempool.space/api/v1/ws';
export const useWebsocket = (hostname: string): WsInstance => {
export const useWebsocket = (hostname?: string): WsInstance => {
const wsEndpoint = `wss://${hostname}/api/v1/ws`;
return {
initClient: ({ options }: WsInterface) =>
wsClient(options, defaultWs, hostname),
wsClient(options, wsEndpoint),
initServer: ({ options }: WsInterface) =>
wsServer(options, defaultWs, hostname),
wsServer(options, wsEndpoint),
};
};

View File

@@ -2,13 +2,13 @@ import { WsInterface, WsInstance } from '../../interfaces/bitcoin/websockets';
import wsClient from '../../services/ws/client';
import wsServer from '../../services/ws/server';
const defaultWs = 'wss://mempool.space/liquid/api/v1/ws';
export const useWebsocket = (hostname: string): WsInstance => {
export const useWebsocket = (hostname?: string): WsInstance => {
const wsEndpoint = `wss://${hostname}/liquid/api/v1/ws`;
return {
initClient: ({ options }: WsInterface) =>
wsClient(options, defaultWs, hostname),
wsClient(options, wsEndpoint),
initServer: ({ options }: WsInterface) =>
wsServer(options, defaultWs, hostname),
wsServer(options, wsEndpoint),
};
};