0

Is possible to use socket.io to create a bidirectional communication when a provided link is opened and to create a tunnel using ngrok from within an electron vue app?

// import dependencies - node context of electron see ipc
const { ipcMain } = require('electron');
const http = require('http');
? not sure on this part - socket.io implementation
const io = require('');

let server;
ipcMain.on('start-server', () => {
  server = http.createServer( (req, res) => {
   //serve a vue app where the external url is provided using localhost:15000 tunneling
...
  }).listen(15000);
});

How I proceed correctly?

newbiedev
  • 2,607
  • 3
  • 17
  • 65

1 Answers1

1

It seems like you need guidance.

StackOverflow isn't designed to give guidance, rather to answer specific questions.

However

Here's what I think you should do:

  1. Create a simple Socket.io app. See this tutorial: https://socket.io/get-started/chat
  2. Use the ngrok npm package to create a tunnel that connects to your Socket.io webserver on your port 15000.
  3. Create a Electon app that loads your Ngrok url.

It's difficult to really help you on this because it's such a broad question but have a go at it and ask further questions if necessary.

Joshua
  • 5,032
  • 2
  • 29
  • 45
  • I've already created an Electron project. [The problem](https://github.com/bubenshchykov/ngrok/issues/218) is that the ngrok module will not work during serve mode and in production! About the socket.io, I've implemented it in past for heroku but you are confirming me that it's implementation is the same, I was worried that there was a difference between electron socket.io implementation and normal nodejs server! – newbiedev Mar 29 '21 at 10:46
  • 1
    As far as I know the Socket.io implementation should be the same. I haven't used Ngrok much so I can't help with that sorry. – Joshua Mar 29 '21 at 19:53