• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

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 3 Dec 2013, 19:26

    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
    • T Offline
      tt_su
      last edited by 3 Dec 2013, 20:55

      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 4 Dec 2013, 02:41

        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
        • D Offline
          Dan Rathbun
          last edited by 4 Dec 2013, 03:01

          Well you might try using a UI::WebDialog.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • J Offline
            jiminy-billy-bob
            last edited by 4 Dec 2013, 07:33

            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
            • T Offline
              tt_su
              last edited by 4 Dec 2013, 10:30

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

              1 Reply Last reply Reply Quote 0
              • J Offline
                jiminy-billy-bob
                last edited by 4 Dec 2013, 13:06

                @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
                • J Offline
                  jolran
                  last edited by 4 Dec 2013, 13:29

                  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
                  • T Offline
                    tt_su
                    last edited by 4 Dec 2013, 14:44

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

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

                    Advertisement