Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75221

qtwebchannel examples - nodejs/chatclient.js use 'dialog' instead 'core'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.0
    • Fix Version/s: None
    • Component/s: Documentation, WebChannel
    • Labels:
      None

      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

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              docteam Qt Documentation Team
              Reporter:
              michal.sestrienka Michal Sestrienka
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes