Browser widget timeout?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Zax
Posts: 134
Joined: Mon May 28, 2007 10:12 am
Location: France

Browser widget timeout?

Post by Zax » Tue Sep 17, 2019 12:42 pm

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.

Klaus
Posts: 11277
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget timeout?

Post by Klaus » Tue Sep 17, 2019 12:46 pm

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

Klaus
Posts: 11277
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget timeout?

Post by Klaus » Tue Sep 17, 2019 12:50 pm

BTW, I will move this thread to the correct forum...

Zax
Posts: 134
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Browser widget timeout?

Post by Zax » Tue Sep 17, 2019 1:34 pm

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
;)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6969
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Browser widget timeout?

Post by FourthWorld » Tue Sep 17, 2019 3:31 pm

What went wrong with the server that it's timing out?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Zax
Posts: 134
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Browser widget timeout?

Post by Zax » Tue Sep 17, 2019 3:52 pm

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. :oops:

Klaus
Posts: 11277
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget timeout?

Post by Klaus » Tue Sep 17, 2019 4:07 pm

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! :D

3. Nope, this seems to be the best place for this thread.
Please try again with my hints in 1.

Zax
Posts: 134
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Browser widget timeout?

Post by Zax » Wed Sep 18, 2019 8:20 am

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?

Klaus
Posts: 11277
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget timeout?

Post by Klaus » Wed Sep 18, 2019 9:26 am

Well, 1 millisecs is a BIT short! 8)
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.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2166
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser widget timeout?

Post by [-hh] » Wed Sep 18, 2019 10:50 am

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.]
shiftLock happens

Zax
Posts: 134
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Browser widget timeout?

Post by Zax » Wed Sep 18, 2019 12:36 pm

I performed another test with:

Button script:

Code: Select all

on mouseUp
	urlTest
end mouseUp

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 ;)

Klaus
Posts: 11277
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget timeout?

Post by Klaus » Wed Sep 18, 2019 12:46 pm

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? :shock:

Zax
Posts: 134
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Browser widget timeout?

Post by Zax » Wed Sep 18, 2019 2:16 pm

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? :shock:
Nooooo dear Klaus! :oops:
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

bogs
Posts: 3940
Joined: Sat Feb 25, 2017 10:45 pm

Re: Browser widget timeout?

Post by bogs » Wed Sep 18, 2019 2:45 pm

I'm kinda curious why putting break points in all of his handlers doesn't trigger past the original handler :roll:
Image

Klaus
Posts: 11277
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget timeout?

Post by Klaus » Wed Sep 18, 2019 3:20 pm

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.

Post Reply

Return to “Internet”