2

I'm working on a project to showcase active RFID tracking of multiple devices in real-time. I've been looking at React VR as a possible way of showing users in remote locations the real-time positioning of the devices within a static, predefined space.

Essentially, I need to know if it is possible to use React VR with socket.io for pushing the real-time locations (x,y,z co-ords) to the frontend?

ugotchi
  • 1,003
  • 1
  • 12
  • 32
  • You will probally want to check out this post: [https://stackoverflow.com/questions/29408492/is-it-possible-to-combine-react-native-with-socket-io?rq=1](https://stackoverflow.com/questions/29408492/is-it-possible-to-combine-react-native-with-socket-io?rq=1) – cidicles Aug 25 '17 at 20:46

1 Answers1

2

I've had success using Socket.io with React-VR to receive real-time Bitcoin transaction updates.

package.json

socket.io-client: "^2.0.4"

Inside Redux store to load and store real-time data from coincap:

...
import io from 'socket.io-client';
...
export function loadTransactionsIntoState() {
  return function thunk(dispatch) {
    let socket = io.connect('http://socket.coincap.io', { jsonp: false })
    socket.on('trades', (tradeMsg) => {
      if (tradeMsg.coin == 'BTC') dispatch(addNewTransaction(tradeMsg.trade.data))
    })
  }
}

I originally had this connection statement inside a React-VR component which worked just as well.