|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
const express = require('express') |
|
|
|
|
const bodyParser = require('body-parser') |
|
|
|
|
const app = express() |
|
|
|
|
const expressWs = require('express-ws')(app) |
|
|
|
|
const Provider = require('./provider') |
|
|
|
|
const log = require('./utils/logs.js') |
|
|
|
|
|
|
|
|
@ -22,4 +23,15 @@ app.use(function (req, res) { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
app.ws('/', function(ws, req) { |
|
|
|
|
ws.on('message', function(msg) { |
|
|
|
|
provider.sendAsync(JSON.parse(msg), (err, jsonResponse) => { |
|
|
|
|
if (err) { |
|
|
|
|
ws.send({error: err}); |
|
|
|
|
} |
|
|
|
|
ws.send(JSON.stringify(jsonResponse)); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
app.listen(8545, () => log('Remix Simulator listening on port 8545!')) |
|
|
|
|