<viznet:server>.send

Send an event to all connected clients

 

<viznet:server>.send(
    id    
    *args    
    **kw    

)

 

id

Event ID


*args

Optional arguments to pass to the clients


**kw

Optional keyword arguments to pass to the clients


Remarks

This command will send an event to all connected clients. The client can register for the event as a normal callback. The event structure is the same as a network event structure.

Return Value

None

Example

Server:

import viznet

viznet.server.start()

MY_EVENT = viznet.id('MyEvent')

.
.
.

viznet.server.send(MY_EVENT,message='Hello')


Clients:

import viznet

viznet.client.connect('ServerName')

MY_EVENT = viznet.id('MyEvent')

def onMyEvent(e):
    print 'Received event from server with message:',e.message
viz.callback(MY_EVENT,onMyEvent)