2018-03-25 01:23:46 +00:00
|
|
|
const vm = require('./vm');
|
2018-03-24 02:02:59 +00:00
|
|
|
const WebSocket = require('ws');
|
|
|
|
|
|
|
|
const ws = new WebSocket(
|
2018-03-24 06:31:04 +00:00
|
|
|
'ws://localhost:8081/debugger-proxy?role=debugger&name=Chrome'
|
2018-03-24 02:02:59 +00:00
|
|
|
);
|
|
|
|
|
2018-03-25 01:23:46 +00:00
|
|
|
vm.reply = obj => ws.send(JSON.stringify(obj));
|
|
|
|
|
|
|
|
ws.onmessage = message => vm.message(JSON.parse(message.data));
|
|
|
|
|
|
|
|
ws.onclose = event =>
|
|
|
|
!event.wasClean ? console.error('Bridge WS Error', event.message) : '';
|
2018-03-24 02:02:59 +00:00
|
|
|
|
|
|
|
module.exports = ws;
|