Not sure whats going on in your code. Must be some bug somewhere that I'm not getting.
This example I worked up does what you want to do (I think):
Code:
import viz
import vizact
viz.go()
IS_SERVER = True #change me to False for client
SERVER_NAME = 'DEV8.hq.worldviz.com' #for client, set to network name or IP of server
import viznet
UPDATE = viznet.id('update')
OTHER_EVENT = viznet.id('OTHER_EVENT')
if IS_SERVER:
viznet.server.start()
def broadcast():
viznet.server.send(UPDATE,message='Hello')
def othersend():
viznet.server.send(OTHER_EVENT,otherMessage='other event')
vizact.ontimer(1, broadcast)
vizact.ontimer(3, othersend)
else:
viznet.client.connect(SERVER_NAME)
def onMyEvent(e):
print 'Received event from server with message:',e.message
viz.callback(UPDATE, onMyEvent)
def otherEvent(e):
print 'Received event from server with message:',e.otherMessage
viz.callback(OTHER_EVENT, otherEvent)