gRPC is added

This commit is contained in:
병준 박 2019-05-12 19:59:09 +09:00
parent e9cf4adac2
commit e40776c47c
4 changed files with 1826 additions and 13 deletions

View File

@ -10,5 +10,6 @@
"git.ignoreLimitWarning": true,
"prettier.singleQuote": true,
"debug.node.autoAttach": "on"
"debug.node.autoAttach": "on",
"cSpell.words": ["grpc", "proto"]
}

1802
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"author": "",
"license": "ISC",
"scripts": {
"electron": "tsc --p ./ && electron ."
"electron": "tsc --project ./ && electron . --serve"
},
"dependencies": {
"electron-devtools-installer": "^2.2.4",
@ -22,7 +22,7 @@
"rxjs": "^6.5.2"
},
"devDependencies": {
"@odds-crawler/proto": "^0.0.4",
"@odds-crawler/proto": "^0.0.6",
"@types/google-protobuf": "^3.2.7",
"@types/node": "^8.9.4",
"electron": "^5.0.0",

View File

@ -4,7 +4,12 @@ import * as url from 'url';
import * as fs from 'fs';
import * as grpc from 'grpc';
import { CDPServiceClient } from '@odds-crawler/proto/cdp/cdp.service_grpc_pb';
import * as CDPServiceProto from '@odds-crawler/proto/cdp/cdp.service_pb';
import * as CDPServiceGRpcProto from '@odds-crawler/proto/cdp/cdp.service_grpc_pb';
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
const appDir = path.join(__dirname, `../../dist/odds-crawler-frontend-app`);
let mainWindow: BrowserWindow;
@ -28,15 +33,12 @@ function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: { nodeIntegration: true }
webPreferences: { nodeIntegration: false }
});
mainWindow.loadURL(
url.format({
pathname: path.join(
__dirname,
`../../dist/odds-crawler-frontend-app/index.html`
),
pathname: path.join(appDir, `/index.html`),
protocol: 'file:',
slashes: true
})
@ -48,10 +50,24 @@ function createWindow() {
mainWindow = null;
});
let cdpServiceClient = new CDPServiceClient(
let cdpServiceClient = new CDPServiceGRpcProto.CDPServiceClient(
'localhost:50051',
grpc.credentials.createInsecure()
);
// let req: CDPServiceProto.NavigateRequest;
// let res: CDPServiceProto.NavigateReply;
// req = new CDPServiceProto.NavigateRequest();
// req.setUrl('https://www.google.com');
// cdpServiceClient.navigate(req, (err, res) => {
// if (err) {
// console.log(err);
// return;
// }
// console.log(res);
// });
}
ipcMain.on('getFiles', (event, arg) => {