Results 1 to 6 of 6

Thread: Client/Server remoting and exports.conf

  1. #1
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,360
    Blog Entries
    22

    Client/Server remoting and exports.conf

    This may not seem like a big deal but it actually is.

    Desktop Apps now recognize exports.conf so that the procs declared in there can be called from Javascript not only in Web/Mobile but Desktop too.

    Any edits made to exports.conf are automatically recognized by Javascript in the Desktop App Builder.

    What does this mean?

    Well what it means is that validation can be fully tested on the desktop now without any need for time consuming test harnesses.

    So... just to summarize.

    You setup an exports.conf file as described in the doc.

    https://www.lianja.com/doc/index.php/Exports.conf

    Then in JavaScript you can call Lianja/VFP server-side procs/functions transparently. This provides a seamless integration of all the supported scripting languages with Javascript.

    So code running on web/mobile can call server-side procs and functions and now the desktop javascript app that you are developing can also call these Lianja/VFP procs and functions. This simplifies testing and should remove any confusion about how to do remoting in Lianja Web and Mobile Apps.

    Remember that when invoking remote procedures in the web/mobile client the server knows nothing about UI or data state. It is "stateless". What this means is that the server proc should open the database and tables that it needs. When testing in desktop the situation is different as the desktop app is stateful. It has the database open and possibly the tables in an active state.

    So, as a best practice you should write any server side procs that work with data like this. e.g.

    Code:
    proc getBalance(database, table, args)
       local result  = 0
       if not isServer()
           push datasession
       endif
       open database &database
       use &table   
       // Insert your code here to do what you need to do
       use
       close database
       if not isServer()
             pop datasession
       endif
       return result
    endproc

    Heres an example of integrating JavaScript and Lianja/VFP.

    Name:  exports_conf.jpg
Views: 153
Size:  138.3 KB






    Last edited by barrymavin; 2018-06-14 at 04:35.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  2. #2
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,893
    you're the best and Lianja is every day most powerfull.

  3. #3
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    I feel this is huge.

  4. #4
    Senior Member
    Join Date
    Mar 2014
    Posts
    124
    Interesting...
    Well we done a lot with POS while waiting for the right version of Lianja. This feature may have something to do with my visit to my local bottle shop last night on the way home (part of a large chain here in OZ) and noticed a new POS. Twin screens 1 with customer view.
    I noticed the POS was running under Chrome and said -
    “what happens when you internet goes down?”
    the proprietor quickly responded
    “no problems everything is stored in the Chrome browser, it will sync back to the cloud when the internet is back”

  5. #5
    I am still trying to separate all of Liana's features in a way I can understand the big picture. I was looking at your code and was very proud to actually understand it when I got a bit confused. I think this is solely a testing issue but I want to clarify this point. When you bracket the code as:
    Code:
    if not isServer()
       push datasession
    endif
    I understand you are testing if the code is in production on the server or in testing in the App Builder, right? And if this were a functioning production call and a Desktop version called this, it would execute on the Server just as the web/mobile, right? Or since the App Builder knows about the server proc does it include it in the Desktop app and run it locally? I know this seems a bit tedious, but I want to insure the I fully understand.

    - James

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,360
    Blog Entries
    22
    The same code runs in the app builder and in the cloud server. The app builder apps have data state with active cursors.

    The cloud server is stateless so by checking isServer() you can determine whether the code is running in the app builder or the cloud server.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us