1
0
Fork 0

WebApp: Abuse Comet to update the status of the connection

This commit is contained in:
Holger Hans Peter Freyther 2010-12-12 10:38:57 +01:00
parent cfb10be704
commit d10427f782
1 changed files with 22 additions and 5 deletions

View File

@ -1,4 +1,5 @@
PackageLoader fileInPackage: 'Iliad-Core'. PackageLoader fileInPackage: 'Iliad-Core'.
PackageLoader fileInPackage: 'Iliad-More-Comet'.
PackageLoader fileInPackage: 'Iliad-More-Formula'. PackageLoader fileInPackage: 'Iliad-More-Formula'.
PackageLoader fileInPackage: 'Iliad-Swazoo'. PackageLoader fileInPackage: 'Iliad-Swazoo'.
@ -11,7 +12,15 @@ FileStream fileIn: 'SCCPHandler.st'.
FileStream fileIn: 'GSMDriver.st'. FileStream fileIn: 'GSMDriver.st'.
FileStream fileIn: 'TestPhone.st'. FileStream fileIn: 'TestPhone.st'.
Iliad.ILCometEvent subclass: PhoneRefresh [
]
Iliad.ILWidget subclass: ServerConfigWidget [ Iliad.ILWidget subclass: ServerConfigWidget [
initialize [
super initialize.
self subscribeToCometEvent: PhoneRefresh.
]
contents [ contents [
^ [:e | ^ [:e |
self application gsmServer isConnected self application gsmServer isConnected
@ -28,15 +37,21 @@ Iliad.ILWidget subclass: ServerConfigWidget [
] ]
connectServer [ connectServer [
| context |
(self application gsmServer) (self application gsmServer)
connect; connect;
serve. serve.
context := self context.
[ [
ILCurrentContext processVariable value: context.
(Delay forSeconds: 5) wait. (Delay forSeconds: 5) wait.
self send: #markDirty. self session cometHandler
handleEvent: PhoneRefresh new.
] fork. ] fork.
] ]
] ]
Iliad.ILWidget subclass: PhoneConfigWidget [ Iliad.ILWidget subclass: PhoneConfigWidget [
@ -142,10 +157,12 @@ Iliad.ILApplication subclass: GSMTestphoneApp [
index [ index [
<category: 'controllers'> <category: 'controllers'>
^ [:e | ^ [:e |
e build: self serverConfig. e
e build: self phoneConfig. build: self cometConnection;
e build: self lu. build: self serverConfig;
e build: self call. build: self phoneConfig;
build: self lu;
build: self call.
]. ].
] ]