| self ServerSide foo. |
Similarly, when we are in the Server can send messages to the Client as follows:
| self clientside bar . |
The Client part, to send the message # ServerSide , it returns a proxy that forwards messages to Squeak using JSON-RPC. In addition, the Server, when we send the message # clientside returns a proxy that forwards messages received, the client, using the Comet connection.
-
- This we already know enough to see the sample code Ping-Pong.
-
- the client side of our example ( SWTPingPongClientApplication ) has only 2 methods, see the first:
| initializeWidgets "Initialize the receiver's widgets" contents: 'Ping Pong' ). root addWidget: ( SWTButton caption: 'ping server' onClick: [ : event ] ). Allí vemos como se crean 2 widgets: Un Header y un Button. Si, lo sé... no es nada espectacular... pero lo interesante está dentro del evento #onClick del botón: self serverSide ping Cuando hagamos click sobre el botón, el mensaje #ping se evaluará, ¡pero del lado del servidor!. Veamos entonces la implementación de #ping in the Server ( SWTPingPongServerApplication ). ping Transcript show: 'ping! " ; |
self
-
clientside
This method, and show something in the Transcript, returns the "favor" to his counterpart in the last line Client.pong.
- Now, finally, consider the implementation of Client side # pong (
SWTPingPongClientApplication ).
- pong
^
self inform : "pong!"
If u like, watch this ScreencastSubscribe to: Post Comments (Atom)
0 comments:
Post a Comment