Methods
|
|
|
|
__init__
|
__init__ ( self, passInfo )
|
|
broadcast
|
broadcast ( self, doc )
broadcasts a public message. note: does NOT send to self
|
|
connectionByID
|
connectionByID ( self, connID )
lookup a connection object by its connection id
|
|
connectionByKey
|
connectionByKey ( self, userKey )
lookup a connection object by its userKey
|
|
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
|
|
logout
|
logout ( self )
|
|
logoutXML
|
logoutXML ( self )
returns a logout tag xml string with the current user's info
|
|
msg
|
msg ( self, doc )
sends a private message to userKey
Exceptions
|
|
userError( "no text attribute" )
userError( "no userKey attribute" )
|
|
|
msgXML
|
msgXML (
self,
msg,
mode=0,
)
returns a msg tag xml string, with a mode flag (private=0, broadcast=1)
|
|
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 full user
list to the client (in no particular order)
|
|
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:
<broadcast text="%s" />
- send a public message
<msg userKey="%s" text="%s" />
- send a private message to userKey
<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
|
|
sendPerson
|
sendPerson (
self,
userKey,
xml,
)
sends the xml string to a particular user specified by userKey
|
|
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
|