7 Replies Latest reply on Dec 6, 2016 2:30 AM by beverly

    Where can I find documentation/examples for using node.js with FMP webpublishing?

    carlo.m

      I'm wondering if anybody has any experience or links to documentation/examples to using node.js (or something like it) to have live updates to websites that use Filemaker Data through PHP.

        • 1. Re: Where can I find documentation/examples for using node.js with FMP webpublishing?
          steve_ssh

          Hello Carlo,

           

          If you find any information about this topic on your own, I'd be grateful if you could post what you find.  I have not personally expored this topic yet, but I have been interested by it.

           

          Very best regards and thank you,

           

          -steve

          • 2. Re: Where can I find documentation/examples for using node.js with FMP webpublishing?
            carlo.m

            Will do...

             

            Hopefully someone else that has some degree of experience trying to use the two will jump on this thread...

            • 3. Re: Where can I find documentation/examples for using node.js with FMP webpublishing?
              carlo.m

              I've done some research.

               

              I found a course on Lynda.com titled Node.js- A first look. With it I have understood that it is a lot more than I thought it was. Among other interesting points:

              • Code is done entirely in Javascript, and when run there is no need for a browser... For those familiar with PHP, instead of writing PHP scripts, you write your scripts in Javascript, and as PHP they are evaluated on the server and then data is sent back to the client (browser).
              • Node has it's own server that serves (instead of, or in conjunction with Apache, For example).
              • There are more than 60,000 modules built in/for node.js, and they are very easy to add to your node.js implementation with npw
              • socket.io is one of those modules, and it makes realtime available in all browers
                • among it's most important features are
                  • var io = require('socket.io').listen(80); //for starting to listen
                  • io.sockets.on('event', callbackFunction)
                  • emit

                  • broadcast

               

              After having a better understanding of what it is, I can see that there is a great relation between socket.io's functionality and Filemaker's native functionality with the client and webDirect, but NOT with CWP. The reason I'm looking into this is that there are some "layouts" (pages) that I need to render in HTML for two reasons:

              1. Design flexibility, content is dynamic, to make better use of screen real estate contenet is arranged to minimize screen waste so more information can be displayed
              2. The data is being updated in irregular intervals because of customer traffic paterns, sometimes updates are available every couple of seconds, and sometimes no updates will occur in several minutes.

               

              I decided on using MBS plugin Server Socket Feature, that in many ways works like socket.io, but restricts the solution to full FM clients (no go, on FM-Go), which is why I'm looking into Node.

               

              The beauty with FM is that all this "live" data is already there... except when you have a found set you wished would be updated when a certain criteria was met. So if one chooses to go down the Node.js path, you have to build the emits/broadcast/on(event,function) into your logic. Which is what I have had to do with the plugin I currently use anyway...

               

              My ideas on how to implement:

              • Only use on mission critical, found set based, changing data that must be available in real time
              • There is a node.js module that can connect to ODBC drivers, thus read/write from FMP (only on mac)
              • There is also a mysql node.js module to interact wtih mysql databases, so maybe incorporate ESS into the mix
              • I imagine a webpage could be created that had both node.js and php components to it. A node.js io.socket to trigger changes to/from a browser and a php call to update accordingly.
              • A webviewer can be added to the FMP side of the equation, where the data that is live-streamed to web-browsers lives in, and could itself trigger an update to be sent to the webviewers
              • 4. Re: Where can I find documentation/examples for using node.js with FMP webpublishing?
                steve_ssh

                Hello Carlo,

                 

                This certainly sounds like a very interesting endeavor, and I am grateful to you for sharing some of the details of your thoughts about it.

                 

                If I understand correctly, it seems that the motivation behind pursuing the use of node.js would be to allow a more "real-time" and interactive exchange between data being served from FMS/FMP, and being read by an FMGo client?

                 

                If this is indeed the case:

                 

                I'd like to share one tidbit that I was playing around with at home a few weeks ago.  I did not post about it, because I did not pursue it far enough to see how robust it might be, as well as for the fact that in non-FMGo cases, the same effect could be achieved more reliably with the use of a plugin (as I believe you have done).  It is in the case of FMGo, where client side-plugins are not an option, that this idea has some small appeal.

                 

                 

                The gist of the idea is:

                 

                Utilize a visible webviewer on a layout being rendered in FMGo, and have the contents of that webviewer involve a trigger field stored in a table on the server side.  When the trigger field is modified, the webviewer updates, and can therefore be used to trigger an FM script on the FMGo client via the FMP URL protocol.  As such, it is possible to have the FMGo client be triggered into action from the server side, or by another FM client.  I believe that this idea could possibly be of use to you, though I am not certain, and moreover as I mentioned, I have not pursued the idea very far.  It is interesting --- you actually came to mind a few weeks ago when I was working with this idea, as someone who might be interested in it.

                 

                I will attach an extremely simple sample file to this post.  Please feel free to send me questions if you have any, and no worries at all if this is not something which you find useful.

                 

                Best regards and thanks again for sharing,

                 

                -steve

                 

                 

                Instructions for sample file:

                 

                   - Host the file somewhere where it can be accessed via both FMP/A  and FMGo

                   - Open the file simultaneously in FMGo and FMP/A

                   - Use the "Trigger" button on the desktop client to trigger a script in FMGo

                   - If all goes well, the trigger button clicked on the desktop client should cause a script to run in the FMGo client

                • 5. Re: Where can I find documentation/examples for using node.js with FMP webpublishing?
                  binu.alexander

                  Hi! I just came across 3 packages on npmjs.com

                   

                  https://www.npmjs.com/package/fms-js

                   

                  https://www.npmjs.com/package/sails-filemaker

                   

                  https://www.npmjs.com/package/plister

                   

                  Can anybody shed some light on these  ,   and how node.js can be used  more for CWP .

                   

                  Also will it be able to be a good alternative for those who already have worked with node.js  ?