Skip to content

Sending sync ipc calls isn't working #5

@probablycorey

Description

@probablycorey

On the atom-shell branch in Atom I'm trying to recreate the functionality of atom.getWindowState using ipc, but it is not working.

On the renderer side I use this code to retrieve data from the browser process:

dataFromBrowser = ipc.sendChannelSync('browser-data-request', 'THIS IS FROM THE RENDERER')
console.log 'got this data from the browser', dataFromBrowser

Here is the code to listen for that event on the browser process (in main.coffee):

ipc.on 'browser-data-request', (processId, messageId, message) ->
  console.log 'browser got request', processId, messageId, message
  ipc.sendChannel('window-state', processId, messageId, "THIS SOME DATA FROM THE BROWSER")

The browser ipc callback gets some strange params though, it gets:

{} 2 1 THIS IS FROM THE RENDERER []

Also, the call to sendChannelSync doesn't return THIS IS SOME DATA FROM THE BROWSER it returns undefined.

Am I using this wrong?
Is there a better way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions