Unsolved Handle ArrayBuffer received via WebSocket's binaryMessageReceived() with QML
I can't find any information getting even close to what I'm looking for - hope someone can be of help.
I'm trying to receive an image sent from C++ as ByteArray via WebSockets in a QML app.
Since there is a newly added (in Qt 5.8) Signal for the WebSocket QML Type that should do just that, I figured I'd use it (see http://doc-snapshots.qt.io/qt5-dev/qml-qtwebsockets-websocket.html#binaryMessageReceived-signal - beware the documentation error, the binaryMessageReceived Signal has an ArrayBuffer as parameter and not a QString, as reported: https://bugreports.qt.io/browse/QTBUG-57906).
However, I have no idea how to handle the ArrayBuffer / binary message that is received in order to show it in a QML object (Image ? Canvas ?).
Can anyone explain to me how this can be done ?
Thanks for your help !
ambershark last edited by
This code looks like it would do the trick. Once you have a url object you should be able to use that as the source for an Image.
This is an assumption on my part but it's something you could look into. :)
Thanks for the link !
I haven't yet been able to get it working.
But I suspect I should probably be using a Loader with a Canvas component, instead of a simple Image element.
I'll test it out and let you know.
If anyone has a working code, don't hesitate to share ^^
I'm sure it would be a great example to include in the docs.