Table of Contents

Class: handlerClass swocket/handler/mousetracker.py

the handlerClass is where everything happens, we don't need auth for this one.

Methods   
__init__
error
log
logdebug
logerror
loginXML
logoutXML
mousemsg
onClose
onConnect
onXML
push
sendEveryone
userError
users
  __init__ 
__init__ ( self,  passInfo )

  error 
error ( self,  error=None )

call this method when a fatal (client must die!) error happens

  log 
log ( self,  text )

  logdebug 
logdebug ( self,  text )

  logerror 
logerror ( self,  text )

  loginXML 
loginXML ( self )

returns a login tag xml string with the current user's info in it

  logoutXML 
logoutXML ( self )

returns a logout tag xml string with the current user's info

  mousemsg 
mousemsg ( self,  doc )

broadcasts a public message. note: does NOT send to self

Exceptions   
userError( "no %s attribute" % n )
  onClose 
onClose ( self )

when disconnecting, send everyone else a logout message

  onConnect 
onConnect ( self )

Upon successful connect, the client broadcasts a login message to all other connected users to notify them to update their user lists, and sends a list of all other connected users to the client

  onXML 
onXML ( self,  doc )

When it receives data from the client, it passes control over to another method. If the method raises an exception, it closes the connection and prints a message to the server console. It otherwise ignores unknown messages, valid messages are:

<mousemsg x1="%d" y1="%d" x2="%d" y2="%d" /> - sends mouse info

<logout /> - logout gracefully

<users /> - return the user list... which isn't necessary, but we already have the method to do it, so we might as well implement it in the case of a really dumb client, like simpleclient

  push 
push ( self,  data )

try to send some text to the client gracefully

  sendEveryone 
sendEveryone ( self,  xml )

sends the xml string to all users except self

  userError 
userError ( self,  error="something bad happened, its probably your fault" )

sends an <error value="%s" /> tag to the client, used if the client happens to send a tag with some invalid stuff in it, or they sent a message to a no longer existing userKey

  users 
users ( self )

Returns an xml document string of the current userlist


Table of Contents

This document was automatically generated on Wed Jul 11 15:14:01 2001 by HappyDoc version r1_5