postMessageAndAwaitResponse: Uncaught Error: The plugin has not registered a handler for synchronous messages. See the documentation for PPB_Messaging::RegisterMessageHandler and PPP_MessageHandler.

274 views
Skip to first unread message

Alex Ivasyuv

unread,
Feb 13, 2015, 5:17:38 AM2/13/15
to native-cli...@googlegroups.com
Hello!

I'm new to NaCl, and I'm not a C++ developer :) I'm trying to emulate blocking thread in JS. I use postMessageAndAwaitResponse.

The issue, that I get an exception:

Uncaught Error: The plugin has not registered a handler for synchronous messages. See the documentation for PPB_Messaging::RegisterMessageHandler and PPP_MessageHandler.


Here's my C++ code:

#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/message_handler.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/var.h"
#include "ppapi/cpp/message_loop.h"

class HelloTutorialInstance : public pp::MessageHandler, public pp::Instance {
public:
explicit HelloTutorialInstance(PP_Instance instance)
: pp::Instance(instance) {

pp::MessageLoop loop;

this->RegisterMessageHandler(this, loop);
}

virtual pp::Var HandleBlockingMessage(pp::InstanceHandle instance,
const pp::Var &var) {
return var;
}

virtual void HandleMessage(const pp::Var &message) {
}

virtual void HandleMessage(pp::InstanceHandle instance, const pp::Var &var) {
}

virtual void WasUnregistered(pp::InstanceHandle instance) {
}
};

class HelloTutorialModule : public pp::Module {
public:
HelloTutorialModule() : pp::Module() {
}

virtual ~HelloTutorialModule() {
}

virtual pp::Instance *CreateInstance(PP_Instance instance) {
return new HelloTutorialInstance(instance);
}
};

namespace pp {
Module *CreateModule() {
return new HelloTutorialModule();
}
}


But after code rebuild I still get the same error. What is wrong with my code?

Ben Smith

unread,
Feb 13, 2015, 2:21:49 PM2/13/15
to native-cli...@googlegroups.com
Hi Alex,

You need to register the message handler on a different thread. Take a look at the messaging example in the SDK.

HTH,
-Ben

Alex Ivasyuv

unread,
Feb 16, 2015, 6:44:19 AM2/16/15
to native-cli...@googlegroups.com
Thank you so much!

TOM HU

unread,
May 22, 2015, 4:15:06 AM5/22/15
to native-cli...@googlegroups.com
Hi, Alex Ivasyuv

Do you have solve this problem? using  like the messaging example in the SDK ?

TOM HU

unread,
May 22, 2015, 4:27:25 AM5/22/15
to native-cli...@googlegroups.com
Hi, Ben Smith

Do you have try to  compile the messaging example with "win" toolchain?  The output file is messaging.dll.

When sending a message to PPAPI module by javascript with function "postMessage",  the PPAPI module  doesn't receive it, no respone.
Reply all
Reply to author
Forward
0 new messages