Looking for solution to build our app with Anvil

Dear community,

We are looking for advice on our app architecture.

We are building an app that aims at developing both mathematical and algorithmic thinking skills of elementary school students. The main part of our solution is an interactive coach that tries to understand the student’s reasoning, skills, and automatisms and that uses this knowledge to guide the student.

So far we have built the coach in Amzi Prolog, running on a Windows AWS server and a GUI build in Tkinter/Python. Communication between Amzi and Python goes through a socket connection (using the socket module on the Python side and using an Amzi extension that supports these socket connections). It is important to note that both the user interface (client) and the server can initiate communication. There is a listener active on both sides.

Since we are almost reaching the stage where we would like to offer our product to actual users we are looking for solutions to make the app available as a web app. We very much like the Anvil services.

We understood from Avil support that the socket module will not work on the Anvil platform. Could you please help us with advice on how we could build the communication between Anvil and the AMZI Prolog logic server on AWS? As mentioned, given the nature of our app, only solutions that allow for the socket (type of) communication to remain open during a user session are an option.

Many thanks in advance for your help.

Hi @sebastiaan,

Looks like Anvil is the perfect tool for you!
You could use a server timer which is polling (each second) from the server.

However this is not really scalable in my opinion. I’d use something like Google Firestore listeners which are almost real time for the job.

But it depends on the data you want to sync and your particular use case.

Greetings - Mark

Thanks @mark.breuss for your help! Much appreciated!

I saw someone mention this website a few days ago, I don’t know if it will help?

https://crossbar.io/

credit goes to this post:

Javascript supports making socket connections. You’ll no doubt have to deal with CORS issues, but doing so seems to be well documented.

Given the Javascript bridge in Anvil, you should be able to call a function in your main form whenever the socket connection receives data, so your Javascript code is limited to receiving and sending socket data, all the processing can happen in client-side Python.

Note that this means the user has access to the data going over the socket connection. If that data is sensitive, this may not be what you want.