Browse Source

feature(websockets): add basic websocket ability

renovate/lint-staged-8.x
Jack Mallers 8 years ago
parent
commit
cebbefe207
  1. 7
      app/routes/app/components/App.js
  2. 8
      app/routes/wallet/components/components/Channels/Channels.js
  3. 5
      package-lock.json
  4. 1
      package.json

7
app/routes/app/components/App.js

@ -1,5 +1,6 @@
// @flow
import React, { Component } from 'react'
import Websocket from 'react-websocket'
import Form from './components/Form'
import Nav from './components/Nav.js'
import styles from './App.scss'
@ -55,6 +56,12 @@ class App extends Component {
<div className={styles.content}>
{children}
</div>
<Websocket
debug
url='ws://localhost:3000/'
onMessage={(data) => console.log('data: ', data)}
/>
</div>
)
}

8
app/routes/wallet/components/components/Channels/Channels.js

@ -42,15 +42,15 @@ class Channels extends Component {
</div>
<ul>
{
!channelsLoading && allChannels.length ?
allChannels.map(channel => {
!channelsLoading ?
allChannels.map((channel, index) => {
if (channel.hasOwnProperty('blocks_till_open')) {
return (
<OpenPendingChannel />
<OpenPendingChannel key={index} />
)
} else if (channel.hasOwnProperty('closing_txid')) {
return (
<ClosedPendingChannel />
<ClosedPendingChannel key={index} />
)
} else {
return (

5
package-lock.json

@ -12500,6 +12500,11 @@
"warning": "3.0.0"
}
},
"react-websocket": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/react-websocket/-/react-websocket-1.1.7.tgz",
"integrity": "sha1-CnYfPeNU1HMfVTQ0VuA7H2AFtJI="
},
"read-config-file": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-0.1.3.tgz",

1
package.json

@ -203,6 +203,7 @@
"react-router-redux": "^5.0.0-alpha.6",
"react-svg": "^2.1.21",
"react-svg-morph": "^0.1.10",
"react-websocket": "^1.1.7",
"redux": "^3.7.1",
"redux-thunk": "^2.2.0",
"reselect": "^3.0.1",

Loading…
Cancel
Save