How to receive message from remote web socket server in electron main process


I am working on a project where I need to receive message from remote web socket. I want to receive the message in main process . The browser I am loading is in remote location. Does not know anything about IPC. Is it possible to receive remote web socket messages without having any IPC communication between main process and remote html?

I am on windows 10 node 6.10


I tried to use node client to listen web socket messages. But I have received no messages from web socket.

let WebSocketClient = require(‘websocket’).client;
let client = new WebSocketClient();
console.log(‘started connection’)

client.on(‘connect’, function(connection) {

  connection.on('error', function(error) {
      console.log("Connection Error: " + error.toString());
  connection.on('close', function() {
      console.log('echo-protocol Connection Closed');

  connection.on('{Client::SetupData', function(message) {
    if (message.type === 'utf8') {
      console.log('Received utf Message: ' + message.utf8Data)

    else if (message.type === 'binary') {
      console.log('Received Binary Message of ' + message.binaryData.length + ' bytes');
    console.log('Received: ' + message);
  connection.onmessage = function(e){
    console.log('received messages from golang',

  connection.send(JSON.stringify('From Browser Client'))