Real-time changes from Xano

HI, is it possible to receive data in real time from xano, like a chat app?

now I fetch the collection again at the end of the workflow

or i need to create a plugin and install some lib for real-time data?

1 Like

Hi @nicolatoledo.dev !

Receive realtime data in a web application require websocket (web protocol for setting up a bidirectionnel canal between a client and a server so the server can inform the client when a new message is posted in the chat for example)
We do not support websocket on weweb for now, you will need to implement your own plugin with websocket capability.

I see Xano has a plugin to enable an external chat service : Xano - Ably Realtime Chat Extension - YouTube
But it looks like its only to do a public chat, and I see no mention of websocket :thinking:

Another solution to exploit this Xano plugin would be to perform a request to the xano database every x seconds to refresh the messages list. But I think we miss an action to setup this type of workflow but you can probably do it with javascript.

Do not hesitate if you have any other questions!

1 Like

Hi, is it possible to get an example of how to setup the collection refresh every x seconds, with step by step instructions of what Javascript to use and where to put it. Thanks.

I think you can just do this with a Workflow and a basic loop, basic example here.

Hi patopt - yep, I’ve tried this. The issue is it runs for all the elements in the array which is finite and therefore it will eventually stop. WeWeb doesn’t allow you for a function to to call itself (recursion). So the issue is, how do you get it to keep running once it’s iterated through the array?

Haven’t tried, but maybe you could create 2 workflows (A & B) where A calls B and B calls A?

Aurelie gives a general example here that uses the a new function that lets you execute workflows from javascript actions.
You need to use wwLib.executeWorkflow instead of simply executeWorkflow.

1 Like

I tried this - you can sort of get it to work with 3 workflows A calls B, B calls C, and finally C calls B and so on. It doesn’t work with just two - you get the same recursion detection error. However, this isn’t really a solution as a its really messy and clearly WeWeb don’t want this to be done.

1 Like

@dorilama thanks Mariano, I’ll give it a go.