Correct, I implement onCustomMessage on both the main thread and web 
worker's Module object (using the emcc --post-js option). Not yet in my 
branch, but I also added the option of sending custom messages pre-main.

I'll add a test and PR what I have.

On Thursday, May 5, 2016 at 8:04:40 PM UTC-7, awt wrote:
>
> Thanks Alon and Hoong Ern for your replies, it looks good to me. Just one 
> question. I did not see onCustomMessage being defined anywhere. Is this 
> something that individual applications need to define themselves?
>
> On Friday, May 6, 2016 at 5:14:35 AM UTC+8, Alon Zakai wrote:
>>
>> Looks useful to me, nice.
>>
>> awt, would that provide what you need?
>>
>> On Thu, May 5, 2016 at 9:27 AM, Hoong Ern Ng <[email protected]> 
>> wrote:
>>
>>> This is the approach that I'm currently using to proxy custom messages 
>>> https://github.com/hoongern/emscripten/commit/6167ec91190723cb8621a26679d5e6cb7022a524
>>> I can PR it if it's deemed useful.
>>>
>>>
>>> On Thursday, May 5, 2016 at 3:17:09 AM UTC-7, awt wrote:
>>>>
>>>> Yes, if we send a 'custom' message over, it will go to the default 
>>>> branch of the webworker's onmessage handler. Do we need to add something 
>>>> to 
>>>> proxyworker.js to support custom data on the worker's side?
>>>>
>>>> On Saturday, February 20, 2016 at 2:54:39 AM UTC+8, Alon Zakai wrote:
>>>>>
>>>>> You should be able to just postMessage to the thread in JS, and 
>>>>> receive it in JS. The only risk is it might confuse our existing 
>>>>> onmessage 
>>>>> on the other side, so we might need to add a "custom message type".
>>>>>
>>>>> On Fri, Feb 19, 2016 at 1:05 AM, awt <[email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a use case where I try to open a local file on the main thread 
>>>>>> and try to send the contents as a buffer to the worker thread. Is this 
>>>>>> possible with Proxy-To-Worker? At present, I only know that we can pass 
>>>>>> keyboard and mouse events over to the worker thread.
>>>>>>
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "emscripten-discuss" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to