dibok

dibok

Support for Qt QML JavaScript?

Hi,

I’m trying to use phoenix.js in my Qt QML project which has it’s own buildin JavaScript engine. Problem is that (what I googled so far) that this engine has cut out WebSocket class, because QML has its own WebSocket component. When I import phoenix.js library and try to create Socket then I get error:

TypeError: Cannot read property 'WebSocket' of undefined

Problem is probably in this line:

this.transport = opts.transport || global.WebSocket || LongPoll;

So in theory, it is possible to inject QML WebSocket{} engine in phoenix.js by Qt.createQmlObject() or Qt.createComponent(). But this probably require change names of original WebSocket’s method names and signals etc. in phoenix.js file.
Did anyone tried this? I’m still newbie in QML and JavaScript, as C++ and Qt Widgetsets programmer, I’m trying to make new project using QML framework so I’m not such experienced to do it by my self.
Regards

First Post!

thomas.fortes

thomas.fortes

Hi and welcome :slight_smile:

How are you initializing your socket?
The phoenix.js docs have a list of options that you can pass when initializing it and transport is one of the options which would allow you to override (as you can see in the line that you highlighted as the source of the error).

Last Post!

dibok

dibok

Look like there is no good C++ wrappers for phoenix. This one wasn’t updated from 7 years so I guess it will not work
https://github.com/jojojames/PhxSocketCPP

Where Next?

Popular in Proposals: Ideas Top

davydog187
I’ve been enjoying the new Streams API, but I keep needing to work around the lack of access to the underlying items. One issue that cons...
New
bamorim
Story behind Recently, I gave a talk on a meetup about improving performance of Phoenix applications and the example app was a LiveView ...
New
sodapopcan
So after complaining about this for the third or fourth time on this forum, I figured I should make a proposal. TL;DR with can be hard t...
New
kccarter
This is likely a feature request unless we’re overlooking something, but it would be a nice improvement to the developer experience if th...
New
superchris
Currently there is no out of the box way to support DOM Custom Events in phoenix. I’ve created a separate library to do this, but I’d lov...
New
shahryarjb
When proposing or suggesting something please consider: As my experience implementing getBoundingClientRect as Phoenix.LiveView.JS funct...
New
byhemechi
Many web frameworks (e.g. Remix, Gatsby) have an option for their link components that begins the navigation request on hover so that whe...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement