Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Working IPC #413

Closed
Rostov4an1n opened this issue Oct 7, 2023 · 14 comments
Closed

Not Working IPC #413

Rostov4an1n opened this issue Oct 7, 2023 · 14 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Rostov4an1n
Copy link

Tell me how you can fix the problem. I created a custom top panel where the close, collapse, expand buttons are located. I want to use the example of the close button to send an IPC, which will close the application when pressed.

But when I tried to download the IPC-communication application template, I was faced with the fact that it does not work.

Can you tell me how to send IPC signals? If you would provide an example of a solution to my problem, then I would be very grateful to you

@Rostov4an1n
Copy link
Author

I saw a Roadmap for future updates of this project, where everything will be fixed. Could you tell me when to expect a future update?

@abrarabedin001
Copy link

My team and I are also facing the same issue. It would be helpful if we could see a working project

@makeusabrew
Copy link

Check out the official Electron examples on IPC communication, specifically this section on communication from the renderer to the main process: https://www.electronjs.org/docs/latest/tutorial/ipc#pattern-2-renderer-to-main-two-way

Here's the code for it: https://github.com/electron/electron/tree/v27.0.0/docs/fiddles/ipc/pattern-2

That example isn't identical, but it's close: you just need to swap out the logic in the main process where the example opens a native file dialog and instead call app.quit(). The principles are identical though.

Happy to help debug any code either of you have got which isn't working once you get close.

@abrarabedin001
Copy link

image

I am importing electron as shown in the example . But I am getting the following error

image

@abrarabedin001
Copy link

here is my background.ts

import { app, ipcMain } from 'electron'
import serve from 'electron-serve'
import { createWindow } from './helpers'

const isProd: boolean = process.env.NODE_ENV === 'production'

if (isProd) {
  serve({ directory: 'app' })
} else {
  app.setPath('userData', `${app.getPath('userData')} (development)`)
}

; (async () => {
  await app.whenReady()

  const mainWindow = createWindow('main', {
    width: 1000,
    height: 600,
    minWidth: 960,
    minHeight: 600,
  })

  if (isProd) {
    await mainWindow.loadURL('app://./home')
  } else {
    const port = process.argv[2]
    await mainWindow.loadURL(`http://localhost:${port}/home`)
    // mainWindow.webContents.openDevTools()
  }
})()

app.on('window-all-closed', () => {
  app.quit()
})


ipcMain.on('ping-pong', (event, arg) => {
  event.sender.send('ping-pong', `[ipcMain] "${arg}" received asynchronously.`)
})

@pixkk
Copy link

pixkk commented Oct 10, 2023

Maybe #396 (comment) can help. Try change renderer settings

@Rostov4an1n
Copy link
Author

image

I am importing electron as shown in the example . But I am getting the following error

image

Greetings. I have the same problem. The developer of this repository said that he will fix IPC-Communication in the next update

@saltyshiomix
Copy link
Owner

I'll fix the bug soon, sorry for inconvenience 🙇

@saltyshiomix
Copy link
Owner

@Rostov4an1n CC: @abrarabedin001 @pixkk

Nextron v8.12.0 is out!
Now it supports preload script for secure IPC features :)

If you have time, please try new examples:

npx create-nextron-app test-app --example basic-lang-typescript

@abrarabedin001
Copy link

thanks for letting us know. Will check it out soon.

@Rostov4an1n
Copy link
Author

@saltyshiomix Thank you very much for the work done! I was able to positively connect the functions of interaction with the buttons of the upper panel of the application via IPC Electron. If I knew how, I could attach a video video evidence 😁🎉

@hfd666
Copy link

hfd666 commented Oct 16, 2023

@Rostov4an1n CC: @abrarabedin001 @pixkk

Nextron v8.12.0 is out! Now it supports preload script for secure IPC features :)

If you have time, please try new examples:

npx create-nextron-app test-app --example basic-lang-typescript

download temp error~

PS E:\project\nextrons> npx create-nextron-app my-app --example basic-lang-typescript
Need to install the following packages:
create-nextron-app
Ok to proceed? (y) y
✔ Validating existence...
⠇ Downloading and extracting...node:events:368
throw er; // Unhandled 'error' event
^

RequestError: connect ETIMEDOUT 20.205.243.165:443
at ClientRequest. (C:\Users\admin\AppData\Local\npm-cache_npx\b53a4342db57cff4\node_modules\got\dist\source\core\index.js:970:111)
at Object.onceWrapper (node:events:510:26)
at ClientRequest.emit (node:events:402:35)
at ClientRequest.origin.emit (C:\Users\admin\AppData\Local\npm-cache_npx\b53a4342db57cff4\node_modules@szmarczak\http-timer\dist\source\index.js:43:20)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
Emitted 'error' event on Request instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ETIMEDOUT',
timings: {
start: 1697426026936,
socket: 1697426026936,
lookup: 1697426026938,
connect: undefined,
secureConnect: undefined,
upload: undefined,
end: undefined,
error: 1697426047978,
abort: undefined,
phases: {
wait: 0,
dns: 2,
tcp: undefined,
tls: undefined,
request: undefined,
firstByte: undefined,
download: undefined,
total: 21042
}
}
}

@Rostov4an1n CC: @abrarabedin001 @pixkk

Nextron v8.12.0 is out! Now it supports preload script for secure IPC features :)

If you have time, please try new examples:

npx create-nextron-app test-app --example basic-lang-typescript

@pixkk
Copy link

pixkk commented Oct 16, 2023

RequestError: connect ETIMEDOUT 20.205.243.165:443

Check your internet connection (or disable/enable VPN for downloading packets).

derechtenap added a commit to derechtenap/dartsmate that referenced this issue Oct 30, 2023
@MuneebChaudhry-dev
Copy link

The issue Still Persist , Nothing changed.

Here is the Error:
image

The issue Occur after the import of "IpcRenderer"
image

Here are my dependencies:
image

@saltyshiomix Kindly look into this.. I have used the electron-react-boilerplate where they wrap the ipc into some kind of API or simple callback functions. Also doing some communication stuff useing electron-store. But I'm still unable to understand your method for communication. Can you please update some documentation at least for some basic things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

7 participants