sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Communication best practice

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 5 Posters 287 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      Garry K
      last edited by

      What is the best practice for communicating from a plugin to a web server?

      I am interested in having a plugin temporarily connect to a web site and check some information in a database then disconnect.

      Currently my plugin works on SU7, SU8 and SU2013 but has only been tested under Windows 7 and Windows 8. I am hoping that the plugin can also run under OSX

      I could use Sockets or I could build a rest or soap Web Service.

      I've heard that OSX includes a full Ruby install whereas Windows does not.

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        OSX ships with Ruby, yes, but SketchUp still uses its own Ruby core which is using Ruby 1.8.5. I think uptil OSX 10.8 it shipped with Ruby 1.8.7 but Mavericks ships with Ruby 2.0. You cannot expect the system Ruby to be compatible with SketchUp's ruby.

        You might want to create a C Extensions that wraps a C/C++ socket or HTTP library.

        1 Reply Last reply Reply Quote 0
        • G Offline
          Garry K
          last edited by

          Unfortunately that means I will have to purchase a Mac.

          I do have C++Builder XE4 that will compile for Windows or OSX with a single code base. But licensing requires that you connect to a real Mac before you can compile for OSX.

          The good part is there is unlimited deployment without license.

          Is there no other sensible way for sketchup to connect to an external website?

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            Well you might try using a UI::WebDialog.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • jiminy-billy-bobJ Offline
              jiminy-billy-bob
              last edited by

              Yes this is trivial with a webdialog.
              I do this with a hidden iframe fetching a php page on my server, which connects to a database.
              You can of course have the webdialog connecting to the php page without an iframe.

              25% off Skatter for SketchUcation Premium Members

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                Yes, if you need a UI Window open any way then you can use AJAX to poll.

                1 Reply Last reply Reply Quote 0
                • jiminy-billy-bobJ Offline
                  jiminy-billy-bob
                  last edited by

                  @tt_su said:

                  Yes, if you need a UI Window open any way then you can use AJAX to poll.

                  I never succeeded to get ajax working with a local html file and a distant server, because of the same origin policy.
                  But I'm probably just too newbie 😄

                  25% off Skatter for SketchUcation Premium Members

                  1 Reply Last reply Reply Quote 0
                  • jolranJ Offline
                    jolran
                    last edited by

                    If I remebered correctly Thomthom recommended JSONP for that. Have tried yet, but I have seen the recommendation in other places.

                    Edit: Here's the thread. but when rereading the post I realize this may not be relevant

                    http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=54288%26amp;p=492113#p492113

                    1 Reply Last reply Reply Quote 0
                    • tt_suT Offline
                      tt_su
                      last edited by

                      Yes, you must make the server dish out JSONP to comply with same-origin policy.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement