App & Node Api Sockets.io not working

Wappler Version : 3.7.6
Operating System : Windows10
Server Model: Node API & EXPRESS App

Expected behavior

Data should be refreshed with sockets.

Actual behavior

No data is rendered at all inside the repeat, when applying the sockets

How to reproduce

So I have created a Node api, which works perfectly and returns data.
I have built my first hello world electron app which shows said data inside a repeat. The problem arises when I enable sockets. Nothing is rendered.

Does the following post help?

Thanks for your reply MH2ag.

I did try that suggestion, as you can see from the screenshot of the code, but alas to no avail.

I have recreated this bug inside a standard NODEJS server model website project, rather than an App project…….I think the problem is with the absolute url path…(which you must have in an app).

One server connect works, and the other does not…….

Is the sockets server connect running on a different server, is it a different project?

Hi Patrick,

Thank you for your reply.

Yes, I have setup a node server project to run the api. Then I setup a different project to create a desktop app.

…but after testing and playing around, I recreated the bug on the same Node server project as a standard website.

When running on a different server/domain you have problems with CORS. https://socket.io/docs/v3/handling-cors/

Were you also able to recreate the issue when working with a website/server in a single project?

I’m not sure how to go about that on the link you sent…

I have the cors option set within Wappler Capture

…and yes, I was able to recreate the issue within the same server/project…… please see screenshot of the code above… it happens when you enter the absolute url in the path for server connect

Please test following update.

dmxAppConnect.zip (22.6 KB)

Unfortunately no. Still no luck.

This may help, as it seems to be causing an issue . The request url is wrong

The request url is indeed strange, is the pages running under localhost, so not opened directly from disk?

This is a simple hello world electron app running on a client.


It appears that this url which I had to enter manually seems to be the issue when running the app…………Wappler generates wrong code that points to a local url. …src=“socket.io/socket.io.js”

The code generated for sockets include should look like:

<script src="socket.io/socket.io.js" defer=""></script>
<script src="dmxAppConnect/dmxSockets/dmxSockets.js" defer=""></script>

Have you manually added the http://10.0.... part?

Yes I manually added the url… @George posted this… Socket not working with mobile app

1 Like

Here a new update, this time the dmxSockets.js file.

dmxSockets.zip (1.1 KB)

Thank you… Alas I am unable to test as now my trial version has run out :disappointed:

Fixed in Wappler 5.1.1

This topic was automatically closed after 31 hours. New replies are no longer allowed.