You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2023. It is now read-only.
msokk edited this page Feb 16, 2011
·
10 revisions
Module developing rules
Server side
Go to /modules
Must export "types" array to specify requests to be caught
Also must export "init" function which is called with "this" being the socket client
and with argument "data", which contains the whole payload from client
There are 4 options to push data :
this.send(msg) - msg is sent back to originating client
this.broadcast(msg) - msg is sent to everybody except originating client
this.listener.broadcast(msg) - msg is sent to everybody
this.listener.announce(msg) - msg is sent to everybody (even anonymous users)
Client side
Go to /public/modules
Subscribe to events with Smog.on(type, callback) - callback gets data variable
Add filters with Smog.filter(name, callback) - callback gets input string
Same event/filter can't be redefined
Events can be removed with Smog.die(type)
Filters can be removed with Smog.removeFilter(name)