On Fri, Jun 1, 2012 at 7:38 PM, catshow <ga...@dynafocus.com> wrote:
>
> My scenario that I am looking at doing is this.
>
> Mac OS/X app xpc_message_send 'start'   --->  xpc_module with node.js
> embedded library initialized
> Mac OX/X app xpc_message_send 'do work'  --> xpc_module receive 'do
> work'  --> node.js event handling mechanism --> js client object
> on('message', function(message) { console.log(message); })
>
> So I am thinking that the binding would be a singleton and the client
> would just get messages forwarded to the singleton.
>

I believe you want to use EventEmitter, though I have no domain
specific knowledge
of xpc itself.

If you can add the event emitter from XPC through a libuv watcher, n
older example using
libev is at [1]. If XPC's event loop is different from the node event
loop, you might want to
run them in two different threads and use uv_async_send [2] to
communicate events across.
Once the event data is in the node loop it is simply a matter of using
EventEmitter.

If you could detail the XPC and node.js flows a bit more in your
specific use case,
I might be able to explain better.

Best,
Nikhil

[1]: https://bitbucket.org/nikhilm/xcbjs/src/317cf973ad77/src/xcbjs.cc
[2]: https://github.com/nikhilm/node-taglib/blob/master/src/taglib.cc#L347

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to