Wappler Version : 4.6.2
Operating System : W10
Server Model: NodeJS
Database Type: PostgreSQL
How to reproduce
We created a fresh NodeJS SPA project with 1 layout page and two content pages - list & chat.
On click of a link in list page, chat page is opened.
The chat content page has socket component defined and a link to go to list page.
For testing, on chat page, we have a message input which submits value via server connect form.
In this server action, there is a emit of the same message configured.
On the chat page, the socket has dynamic element message defined to show the value from emit in a browser alert.
When I click on link in list page, and send a message multiple time, I always receive one browser alert for each message.
Now, I go back to list page and click the chat page link.
Then, on chat page, if I send a message, I receive two browser alerts for each message.
I can see in the WS type in Dev tools network tab that there is only 1 message being received from the server… but the client is running the message dynamic event multiple times.
Every time I repeat the back-forward flow, number of alerts increase by one.
If I move the socket component from content page to layout page, everything works fine.
Interestingly, I have another project where I have sockets on content page and it works as expected above.
But not in this newly createed project.
Are sockets not supported in content pages in SPA? Please help.