From d10427f782a4a971e3d42af14ca8ca318ce27296 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 12 Dec 2010 10:38:57 +0100 Subject: [PATCH] WebApp: Abuse Comet to update the status of the connection --- WebApp.st | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/WebApp.st b/WebApp.st index e4921c7..95eeb0f 100644 --- a/WebApp.st +++ b/WebApp.st @@ -1,4 +1,5 @@ PackageLoader fileInPackage: 'Iliad-Core'. +PackageLoader fileInPackage: 'Iliad-More-Comet'. PackageLoader fileInPackage: 'Iliad-More-Formula'. PackageLoader fileInPackage: 'Iliad-Swazoo'. @@ -11,7 +12,15 @@ FileStream fileIn: 'SCCPHandler.st'. FileStream fileIn: 'GSMDriver.st'. FileStream fileIn: 'TestPhone.st'. +Iliad.ILCometEvent subclass: PhoneRefresh [ +] + Iliad.ILWidget subclass: ServerConfigWidget [ + initialize [ + super initialize. + self subscribeToCometEvent: PhoneRefresh. + ] + contents [ ^ [:e | self application gsmServer isConnected @@ -28,15 +37,21 @@ Iliad.ILWidget subclass: ServerConfigWidget [ ] connectServer [ + | context | (self application gsmServer) connect; serve. + context := self context. [ + ILCurrentContext processVariable value: context. + (Delay forSeconds: 5) wait. - self send: #markDirty. + self session cometHandler + handleEvent: PhoneRefresh new. ] fork. ] + ] Iliad.ILWidget subclass: PhoneConfigWidget [ @@ -142,10 +157,12 @@ Iliad.ILApplication subclass: GSMTestphoneApp [ index [ ^ [:e | - e build: self serverConfig. - e build: self phoneConfig. - e build: self lu. - e build: self call. + e + build: self cometConnection; + build: self serverConfig; + build: self phoneConfig; + build: self lu; + build: self call. ]. ]