Gaëtan Renaudeau
6 years ago
2 changed files with 8 additions and 28 deletions
@ -1,10 +1,18 @@ |
|||||
// @flow
|
// @flow
|
||||
import WebSocket from 'ws' |
import WebSocket from 'ws' |
||||
import { setNetwork, setWebSocketImplementation } from '@ledgerhq/live-common/lib/network' |
import { setNetwork, setWebSocketImplementation } from '@ledgerhq/live-common/lib/network' |
||||
|
import { logs as websocketLogs } from '@ledgerhq/live-common/lib/api/socket' |
||||
import { setEnv } from '@ledgerhq/live-common/lib/env' |
import { setEnv } from '@ledgerhq/live-common/lib/env' |
||||
import network from 'api/network' |
import network from 'api/network' |
||||
import * as constants from 'config/constants' |
import * as constants from 'config/constants' |
||||
|
import logger from 'logger' |
||||
|
|
||||
setWebSocketImplementation(WebSocket) |
setWebSocketImplementation(WebSocket) |
||||
setNetwork(network) |
setNetwork(network) |
||||
setEnv('FORCE_PROVIDER', constants.FORCE_PROVIDER) |
setEnv('FORCE_PROVIDER', constants.FORCE_PROVIDER) |
||||
|
|
||||
|
websocketLogs.subscribe(({ type, message, ...rest }) => { |
||||
|
const obj = rest |
||||
|
if (message) obj.msg = message |
||||
|
logger.websocket(type, obj) |
||||
|
}) |
||||
|
Loading…
Reference in new issue