react-native-firebase/tests-new/bridge/env/node/ws.js

13 lines
399 B
JavaScript
Raw Normal View History

2018-03-24 02:02:59 +00:00
const WebSocket = require('ws');
const ws = new WebSocket(
// todo read url from somewhere
'ws://' + 'localhost:8081' + '/debugger-proxy?role=debugger&name=Chrome'
);
ws.onmessage = message => process.emit('ws-message', JSON.parse(message.data));
2018-03-24 05:53:49 +00:00
// ws.onopen = () => console.log('WS open');
2018-03-24 02:02:59 +00:00
ws.onclose = event => (!event.wasClean ? console.log('WS close', event) : '');
module.exports = ws;