Web and Mobile Apps are stateless.
What this means is that you cannot guarantee a persistent connection between the Web client and the server.
When requests are made by the browser these arrive on the server and are handled by worker processes based on their availability. Lianja uses connection pooling to optimize performance.
Not only does it use connection pooling for web requests it also uses ODBC connection pooling to handle Virtual Table access.
Therefore, executing a command only affects the server process that the command runs on. It has no effect on the client and the next Lianja.execute() may run in a completely different server context.
In Lianja v2.0 we have made it dramatically easier to share data in real time between multiple Lianja processes running in parallel.
In HTML5 Web/Mobile there is the concept of “localStorage” and “sessionStorage”.
In the Lianja v2.0 Desktop client “sessionStorage” is non persistent data that can be shared across multiple concurrent processes e.g. background processes gathering data from instruments or multiple Lianja windows on the desktop.
Access to data in sessionStorage is handled automatically for you so that concurrent reads, updates and removing of data items is atomic.
You access sessionstorage from the Lianja system object Lianja.sessionStorage.
// The number of key/value pairs in sessionStorage
// These should be quite explanatory Lianja.sessionStorage.setItem(key, value) value = Lianja.sessionStorage.getItem(key) Lianja.sessionStorage.removeItem(key) Lianja.sessionStorage.clear()
Lianja uses a shared memory segment to maintain sessionStorage.
Lianja will automatically keep the keys and their values consistent between each running process as you reference the items stored in SessionStorage. If you want to keep complex objects as the values for keys then use json_encode() and json_decode() to handle serialization and deserialization of the objects.
// in the main process App private myobj = object("name" => "Barry", "company" => "Lianja") Lianja.setItem("myobj", json_encode(myobj) )
// then in another process that needs to read objects from the main App window private myobj = json_decode( Lianja.sessionStorage.getItem("myobj") )
Note that each time you call any of the methods or reference the length property the shared sessionStorage will be automatically kept current for you.
there is a “Session data changed” delegate and a “Session data changed interval” in App Settings.
Lianja will check for changes in the sessionStorage every #msecs and call the “Section data changed” if any changes in the sessionStorage have been made.
This is fast as a transaction sequence number is kept as part of the sessionStorage so no deserialization of data is required.
There is also a property called “datachanged” and “datachangedinterval” (in milliseconds) so this can be used by non GUI applications (background worker processes etc).
In Lianja v2.0 you also have several new classes that handle custom shared memory access and custom system semaphores.
New “SharedMemory” system class
m_shareddata = createObject("sharedmemory") // attach will create the shared memory if it does not exist. Args are the "key" and the "size" m_shareddata.attach("com.lianja.myshareddata", 64*1024) // set key/value pairs m_shareddata.setItem("mykey", somevalue) // get value m_value = m_shareddata.getItem("mykey")
New “SystemSemaphore” system class
m_sem = createObject("SystemSemaphore") // setKey will create the SystemSemahore if it does not exist. m_sem.setKey("com.lianja.mysem") // acquire exclusive access to a resource across multiple running processes m_sem.aquire() // do something... // release access to the resource m_sem.release
Up until now, I have only created desktop apps. I am now planning on making my apps available for the web.
My current apps use VFP/Recital code.
I am also not used to programming for a client / server design.
Here are just some of the questions I have.
1. When do you use rsp (Visual FoxPro Server) pages?
3. What and when is jquery, json or odata used?
4. How and why would you use each of these?
Lianja is a complete Apps platform.
It is not just an IDE nor is it just a language.
You build Apps visually using “best practices“.
Apps are built out of pages and pages consist of sections etc.
You can build Web and Mobile Apps just as you can build desktop apps if you follow best practices. “Think NoCode“.
There are many pre-built sections that have a lot of built-in functionality. “Think Login page -> App Center -> Apps -> Pages -> UI Navigation“.
There are occasions where you may want to build a custom UI that incorporates other UI widgets that you like.
To answer your questions.
3. You don’t need to know unless you are building custom WebViews.
4. See above.