From: <wsa...@ws...> - 2002-12-11 08:30:17
|
On Tuesday, December 10, 2002, at 02:20 PM, Asynch Messaging wrote: >> Enough of my ramblings, somtimes between now and next year I should >> find >> time between diapy changes to install and start testing out ideas. Any >> thoughts on the matter would be happily used and appreciated. > > When you use mod_pubsub (or any pub/sub messaging) it's better to think > about each participant having the state rather than a single server. > Although mod_pubsub will hold onto the events for as long as you want > (essentially making them permanent 'resources' - think of a config > file that > you subscribe to & you always get notified if it changes) it's more > meant to > distribute state changes in order to synchronize state across machines. Ya. I wrote the beginning of a pub/sub Chess game server for KN a while ago: http://cvs.developer.knownow.com/index.cgi/Applications/Gateways/chess/ It requires an older version of the C Microserver (the one I wrote, san the perverse "beautification" of the API that followed). Don't know if we're going to get that source code. Anyway, the way it worked is the server was a KN client which could talk to a CECP chess engine (I used crafty, another is GNU chess). A client could send moves to a "white" topic on the KN server, then the chess server would see the move. It would pass it along to chess engine. If the move was valid, it gets posted to the "moves" topic. If not, an error gets posted to "white". The engine then makes its move, which also gets posted to "moves", etc. The idea is that if we ever get ACLs for topics, you can limit posts to "white" to the client and the chess server, and post to "moves" are limited to the chess server. Anyone would be able to subscribe to "moves", which allows them to watch the game. Two players would add a "black" topic that only a second client can post to, and the chess engine would serve to verify the validity of moves, but obviously won't make its own moves. The game was intended to illustrate a couple of techniques: - creating a reasonable topic schema for an application - ansyncronous activity in a single threaded C app (it has to listen to the chess engine and to KN events) -wsv |