Page 1 of 2
Browser widget timeout?
Posted: Tue Sep 17, 2019 12:42 pm
by Zax
Hello,
I'm not familiar with the Browser widget and I would like to know the better way to set and handle a timeout while loading a distant web page in an existing Browser widget.
I know I can check is the page is loaded or failed with browserDocumentLoadComplete and browserDocumentLoadFailed, but I don't know how to manage a timeout.
I'm using LC Indy 9.04.
Thank you.
Re: Browser widget timeout?
Posted: Tue Sep 17, 2019 12:46 pm
by Klaus
Hi Zax,
not sure if this also applies to the browser widget, but try to:
Code: Select all
...
set the socketTimeoutInterval to XXXX
## Where XXXX is the amount in millisecsonds
...
Best
Klaus
Re: Browser widget timeout?
Posted: Tue Sep 17, 2019 12:50 pm
by Klaus
BTW, I will move this thread to the correct forum...
Re: Browser widget timeout?
Posted: Tue Sep 17, 2019 1:34 pm
by Zax
Hello Klaus !
socketTimeoutInterval doesn't seem to work with a Browser widget.
That's why I originaly posted in Widgets sub-forum, following
[-hh] 's advice here:
https://forums.livecode.com/viewtopic.p ... 6&start=15
[-hh] wrote: ↑Mon Sep 16, 2019 12:31 pm
There is an own subform for LiveCode Builder (especially widgets (especially the browser widget)):
viewforum.php?f=93

Re: Browser widget timeout?
Posted: Tue Sep 17, 2019 3:31 pm
by FourthWorld
What went wrong with the server that it's timing out?
Re: Browser widget timeout?
Posted: Tue Sep 17, 2019 3:52 pm
by Zax
Well,
socketTimeout message doesn't seem to be sent, even when I use:
Code: Select all
set the socketTimeoutInterval to 1
In fact, I think I don't understand how to use sockets with Browser widget. Documentation says:
If the socketTimeoutInterval passes and no data has been transmitted yet, the socketTimeout message is sent to the object(glossary) whose script contains the read from socket or write to socket command.
But where should I read or write this socket when using Browser widget?
Klaus, maybe you will have to move this thread to the
Beginner section.

Re: Browser widget timeout?
Posted: Tue Sep 17, 2019 4:07 pm
by Klaus
1. "sockettimeoutintervall" is NOT a message but a global property, which decides after what time a "socket" action (read/write) is considered to be "timed out". So you need to set this to a desired value BEFORE you set the url of the browser widget.
2. You don't have to "use" sockets with the Breowser widget, the widget does this by its own!
3. Nope, this seems to be the best place for this thread.
Please try again with my hints in 1.
Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 8:20 am
by Zax
This is what I tried:
Test button script
Code: Select all
on mouseUp
set the socketTimeoutInterval to 1--milliseconds
set the URL of widget "BrowserTest" to "https://livecode.com"
end mouseUp
Browser widget script
Code: Select all
on socketTimeout
answer "Timeout! (widget)"
end socketTimeout
Card script
Code: Select all
on socketTimeout
answer "Timeout! (card)"
end socketTimeout
socketTimeout message doesn't seem to be sent, as I don't see the answer dialog (even if I change the value of
socketTimeoutInterval)
What I am doing wrong?
Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 9:26 am
by Klaus
Well, 1 millisecs is a
BIT short!
Default value is 10000 = 10 seconds, as one can read in the
dictionary entry about "sockettimeoutintervall".
So give it a bit more time for your action, if it times out in these default 10 seconds and see if that helps.
As I said, I am not sure if this and/or the "socketimeout" message does also apply to the browser widget.
Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 10:50 am
by [-hh]
No matter what you do later on with the url data, you could use "load url" which has an optional callback message and is not blocking.
[Klaus is right. This is nothing special to the browser widget (that displays the url). That's "internet" in general.]
Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 12:36 pm
by Zax
I performed another test with:
Button script:
Card script
Code: Select all
on urlTest
set the socketTimeoutInterval to 1000--milliseconds
put "https://livecode.com" into theUrl
unload URL theUrl -- clear cache
load URL theUrl with message "loadingComplete"
end urlTest
on loadingComplete
answer "loadingComplete (card) ***"
end loadingComplete
on socketTimeout
answer "Timeout! (card) ***"
end socketTimeout
And I still never saw the
socketTimeout message.
I can't test values of socketTimeoutInterval greater than 2 seconds because my internet connexion is fast and didn't find very slow websites at this time

Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 12:46 pm
by Klaus
Zax wrote: ↑Wed Sep 18, 2019 12:36 pm
I can't test values of socketTimeoutInterval greater than 2 seconds because my internet connexion is fast and didn't find very slow websites at this time

In your initial posting you said that you get a TIMEOUT ("...while loading a distant web page in an existing Browser widget")
and now you are telling us you don't?

Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 2:16 pm
by Zax
Klaus wrote: ↑Wed Sep 18, 2019 12:46 pm
In your initial posting you said that you get a TIMEOUT ("...while loading a distant web page in an existing Browser widget")
and now you are telling us you don't?
Nooooo dear Klaus!
I asked how to correctly
handle a timeout.
I said I have a fast connexion, but slow connexion happens (for example when my provider is half-down by a cyber attack ^^, and slow websites exist). If I create a little utility with a Browser widget, I think I have to handle some errors, including timeout.
EDIT
I found a rather slow website, just try:
https://community.adobe.com/t5/Photoshop/bd-p/photoshop
Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 2:45 pm
by bogs
I'm kinda curious why putting break points in all of his handlers doesn't trigger past the original handler

Re: Browser widget timeout?
Posted: Wed Sep 18, 2019 3:20 pm
by Klaus
I am not very familiar with all this internet stuff and "socketimeoutintervall" was
the first thing that came into my mind. I'm afraid I cannot be of any more help.