StdLib HTTP in SketchUp


#1

Since 2017 SU has been shipped with its own Http module. The docs state:

The Http module provides interfaces to create asynchronous HTTP requests. This is an alternative to the Net::Http module that comes with Ruby StdLib - which is known to have issues within SketchUp.

However, there is no reference to what these issues with the StdLib are. Has anything been written on this topic?


#2

I would like to know more on this subject as well. I have used the stdlib in the past and can not remember having issues with it.


#3

That’s interesting to know. I’m in the process of deciding whether to support SU 2016 and earlier for a certain extension. I haven’t tried the StdLib module myself yet, as this could very well be a problem that doesn’t affect my machine, and I end up publishing an extension that works for some but not for others.


#4

Basically it is synchronous and blocking. (I’m using it right now on a project, but only for SU2016.)

I attempted to wrap their use within C++ timer blocks via UI.start_timer() in hopes it would not block, but it did not help and just created more headaches (ie, an extra stack level according to Ruby, and run away browser dialog instances if a net error messagebox dialog needed to be shown from within the block.)

So I’ve just had to live with their blocking nature, but pings and authentication happen so fast it’s is hardly noticeable. Other get operations for cloud data searches do have a noticeable delay 5-8 seconds but “such is life.”


#5

Thanks Dan! Exactly the info I needed!

Then I should probably fall back to StdLib when Sketchup::Http isn’t available, and let the users with old SU versions have to live with the program being blocked for a few seconds when interacting with the plugin.


#6

I’ve filed an API issue for getting the explanation into the docs: https://github.com/SketchUp/api-issue-tracker/issues/110


#7

And I added some notes and method comparison tables …