1

I'm developing an Ubuntu Touch application which communicates with a server using WebSockets. Qt offers its own API since version 5.3, which can be used from a QML file by adding import QtWebSockets 1.0. However, despite having Qt 5.4 and the libqt5websockets5 package installed on a 15.04 emulator image, I get the following error:

/path/to/Main.qml:2 module "QtWebSockets" is not installed

Is it possible to use WebSockets somehow with Ubuntu Touch's Qt?

Xerz
  • 4,591
  • 3
  • 23
  • 37
  • 1
    FTR, the QML bindings to Qt's websockets are provided by `qml-module-qt-websockets`. But that seems to be installed by default (at least on my device), so this is probably not your problem. – Robert Schroll Jul 06 '15 at 17:55

1 Answers1

2

Try import Qt.WebSockets 1.0. This is the module name given in the qmldir file.

The QML Documentation says that the QtWebSockets name was introduced in Qt 5.5; prior to that, the namespace was Qt.WebSockets. Apparently, the old namespace is still active in 5.5, so I'd use it for the time being.

Robert Schroll
  • 1,308
  • 8
  • 13
  • Are you kidding me. – Xerz Jul 07 '15 at 10:55
  • @Pilot6 It does, indeed, give an answer. According to Qt's official documentation, it is supposed to be `QtWebSockets 1.0`, without the dot. So it was not an errata. – Xerz Jul 07 '15 at 11:11