Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.0
-
None
-
b19e610e7de40815fd15e5398ad69ec69d05c41b (qt/qtwebchannel/5.14)
Description
Hello,
based on README, webchannel client
- .../5.12.0/Src/qtwebchannel/examples/webchannel/nodejs/chatclient.js
example should cooperate with webchannel server
- .../5.12.0/Src/qtwebchannel/examples/webchannel/standalone/main.cpp
chatclient.js use 'dialog', but server standalone/main.cpp expose 'core' as object:
Core core(&dialog);
channel.registerObject(QStringLiteral("core"), &core);
This helps:
— a/Qt/qt5examples/qtwebchannel/qtwebchannel_examples/nodejs/chatclient.js
+++ b/Qt/qt5examples/qtwebchannel/qtwebchannel_examples/nodejs/chatclient.js
@@ -85,7 +85,7 @@ var createWebChannel = function(transport, rlif) {
// i.e. the server wants to 'send text'.
// This can be confusing, as we connect to the signal
// to receive incoming messages on our side
- channel.objects.dialog.sendText.connect(function(message) {
+ channel.objects.core.sendText.connect(function(message) {
process.stdout.cursorTo(0);
process.stdout.clearLine(0);
console.log(' << ' + message);
@@ -107,7 +107,7 @@ var createWebChannel = function(transport, rlif) {
// is called with our message.
// Again the naming is for the server side,
// i.e. the slot is used by the server to receive text. - channel.objects.dialog.receiveText(l);
+ channel.objects.core.receiveText(l);
console.log(' >> ' + l);
}
rlif.prompt();
Thanks