comet

9 views
Skip to first unread message

Siemen Baader

unread,
Feb 13, 2020, 8:15:44 AM2/13/20
to il...@googlegroups.com
Hi,
is comet working in Iliad?

I was experimenting with the ILCometCounter example and it seems to me that the example just works because ILCometCounter >> #decrease calls both self markDirty and self triggerCometEvent: ILCometCounterChangedEvent new.
Commenting out the triggerCometEvent: has no effect. Nothing happens when I change it to:

decrease
     [ 5
         timesRepeat: [ counter decrease.
            self markDirty.
            self triggerCometEvent: ILCometCounterChangedEvent new.
            1 seconds wait ] ] fork

Which I thought should decrease the counter visibly over 5 seconds.

Network log shows a long-polling xhr request that returns after 1:36 min and a new one is set up, so something is happening.

Perhaps comet has been disabled or broken and just gone unnoticed since the example does not really rely on server side push? Or am I forking the process in the wrong way for Iliad? Similar code works when just logging to Transcript.

cheers
Siemen

benoit

unread,
Feb 15, 2020, 6:24:14 AM2/15/20
to il...@googlegroups.com
Hi Siemen,

I never used the Comet part of Iliad and I don't know a lot about it.
But what I found working in the ILCometCounter is that :
- open the app in a first browser, increment the counter ;
- open the app in a second browser, the counter will be allready
incremented ;
- increment/decrement it in either browser and the change is immediatly
visible in the other browser.

From my understanding in the increase method :
- self markDirty is for updating the session where the action was done ;
- self triggerCometEvent: ILCometCounterChangedEvent new is for
updating the other opened sessions of the ILCometCounterApplication.


I am not sure why your test with timesRepeat doesn't work.
I tried to update the counter from a Playground with :
ILCometCounterModel instance increase.
but it isn't working as the singleton model is updated but the event
isn't sended to Iliad sessions.
Looking more to the Comet code It doesn't seemed to be an entry point
to send events from outside Iliad. It should be not too hard to add one
however.

Cheers,
Benoit

Le 13/02/20 à 14:15, Siemen Baader a écrit :
> --
> You received this message because you are subscribed to the Google
> Groups "Iliad project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to iliad+un...@googlegroups.com
> <mailto:iliad+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/iliad/CAM47ZxpZEv-Ef0SJgBniJ59DkTHLeAJBoQ-pJtYVE2YJqhhJew%40mail.gmail.com
> <https://groups.google.com/d/msgid/iliad/CAM47ZxpZEv-Ef0SJgBniJ59DkTHLeAJBoQ-pJtYVE2YJqhhJew%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Yuet Ip

unread,
Apr 13, 2020, 8:41:47 AM4/13/20
to Iliad project
Hello Benoit/Siemen,

Just loaded up the latest Pharo 6 and loaded the stable version of Iliad, all on Windows 10.
Something is not quite right with the Comet example for me. 
Opening a new browser (Chrome) does indeed show the latest value, however changing the value in one browser does not update any others. 
(At least not "immediately")
I haven't timed it, but I guess it takes around 2 minutes  for the other browsers to catch up...and show the latest counter value.... very strange.

Any thoughts? How do you go about finding what the problem is?

Cheers!

Yuet

Siemen Baader

unread,
Apr 13, 2020, 10:10:42 AM4/13/20
to il...@googlegroups.com
Hi Yuet & Benoit,

I actually made it work but missed to write back. I'll look at my code get back to you. The implementation is indeed like Benoit outlined - the Comet event triggering mechanism explicitly executes every other session than the current one. This looks intentional, it just seems like the use case of having a server-side process trigger a Comet event has not been considered in the original implementation.

I'll get back with details in the near future.

Thanks for the pointers back then, Benoit!

-- Siemen





To unsubscribe from this group and stop receiving emails from it, send an email to iliad+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iliad/c022bf08-73a1-4915-8e65-dc236b647221%40googlegroups.com.

benoit

unread,
Apr 20, 2020, 5:36:36 AM4/20/20
to il...@googlegroups.com
Hello Yuet,

I don't have any idea on what could be the issue. I wasn't able to
reproduce it.
When I test on Windows 10 between Chrome and Internet Explorer
changing the value is instantaneous (as really after the click the two
windows are updated at the same time). By the way this is with a local
Pharo install. Could it be that your browsers have distinct network
configuration ?

If I add to investigate this, my first idea would be to check if the
delay is in Iliad/Pharo or not. To do that... Hum I was going to say to
log something in IliadKom convertResponse: but I have no idea to how
Comet is sending updated data to the client, so not sure it's using
Comanche.
I never played with the inner of Comet and there isn't a lot of
comments to get how it works... Well, quickly looking at the code, I
think I would begin in ILWidget->triggerCometEvent: or maybe in
IlCometHandler->push.

@+
Benoit



Le 13/04/20 à 14:41, Yuet Ip a écrit :
> > an email to il...@googlegroups.com <javascript:>
> > <mailto:il...@googlegroups.com <javascript:>>.
> <https://groups.google.com/d/msgid/iliad/CAM47ZxpZEv-Ef0SJgBniJ59DkTHLeAJBoQ-pJtYVE2YJqhhJew%40mail.gmail.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/iliad/CAM47ZxpZEv-Ef0SJgBniJ59DkTHLeAJBoQ-pJtYVE2YJqhhJew%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Iliad project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to iliad+un...@googlegroups.com
> <mailto:iliad+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/iliad/c022bf08-73a1-4915-8e65-dc236b647221%40googlegroups.com
> <https://groups.google.com/d/msgid/iliad/c022bf08-73a1-4915-8e65-dc236b647221%40googlegroups.com?utm_medium=email&utm_source=footer>.

Yuet Ip

unread,
Apr 20, 2020, 9:35:14 AM4/20/20
to il...@googlegroups.com
Hello Benoit,

Ummm strange mine was a local install too..so this is most mysterious!
Thanks for the hints I’ll look into them.

Ultimately my target System would be running (Iliad / Aida Web) on GemStone. To this end, my self education would start with Zinc on Pharo, Zinc on GemStone; and getting some sort of websocket examples working in these environments.

Has anyone attempted the port of Iliad to GemStone? I wouldn’t want to redo something that has already been done.

Cheers!

Yuet


To unsubscribe from this group and stop receiving emails from it, send an email to iliad+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iliad/fc91a6eb-3e07-9242-e3a3-ca33ff8d8c45%40free.fr.

Siemen Baader

unread,
Apr 24, 2020, 7:04:42 AM4/24/20
to il...@googlegroups.com
Hi Yuet, Benoit, everyone,

I found the code. What I did is I ran an interactive debugger on 'self triggerCometEvent: ' in my widget code. It is inherited from ILWidget. This led me to ILCometHandler #triggerEvent: which looks like this:

"protocol: actions"
triggerEvent: anEvent
     self otherHandlers do: [:each |
     each handleEvent: anEvent]

which I monkeypatched to:

"protocol: actions"
triggerEvent: anEvent
     "Added by SiemenBaader and appears to work.. otherHandlers are empty. Hm..."

     "--------------"
     self handleEvent: anEvent.
     "------------"
     self otherHandlers do: [ :each | each handleEvent: anEvent ]

ILCometHandlers #otherHandlers is only used by this method, so together with the ILCometCounterExample, which updates its count directly via #markDirty it seems to me that Iliad comet has simply been designed for use cases like chat where different sessions update each other - and not ones where the current session's UI is updated by a long-running server process.

I have attached a fileout of a small working clock app that shows the time on the server via comet. It requires the above patch which is not included in the fileout. 

Please share what you think & find out.

cheers
Siemen


NightClock.st

Yuet Ip

unread,
Apr 24, 2020, 11:09:39 PM4/24/20
to il...@googlegroups.com
Siemen,

Yay! The patch works as described.
Thank you so much!

Cheers!

Yuet

Reply all
Reply to author
Forward
0 new messages