Thanks for the quick feedback.

The XPC Module would be receiving messages in a Grand Central Dispatch
serial queue that I create, so it would NOT be receiving them in the
same thread as node/v8 is running.

So I guess that I would have to use the uv_async_send().  Is that well
documented?  I haven't looked yet.

My idea is that I want to push messages from my mac app to a node.js
app running in an XPC module.

I would also like to respond to the original XPC message, and be able
to send messages to another XPC module from the javascript code.  So I
would need to be able to create an XPC_Object and then dispatch the
message out.

In your code you have an AsyncResolverBaton, is that a nodejs class,
or is that your creation?  It looks like the baton.request.data is
just a void pointer to a c object, so I could probably pass the
xpc_object with that.  Would that be a safe assumption?

I will read up on EventEmitter.

Thanks again.
Garry

On Jun 1, 10:53 am, Nikhil Marathe <[email protected]> wrote:
> On Fri, Jun 1, 2012 at 7:38 PM, catshow <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to