Continue writing thesis
This commit is contained in:
18
listings/event_handler_example.py
Normal file
18
listings/event_handler_example.py
Normal file
@ -0,0 +1,18 @@
|
||||
from tfw import EventHandlerBase
|
||||
|
||||
class MyFirstEventHandler(EventHandlerBase):
|
||||
def __init__(self):
|
||||
super().__init__(self, key='fsm_update')
|
||||
|
||||
def handle_event(self, message):
|
||||
print('I have received a message! Yaaay!')
|
||||
|
||||
# the return value of this method is automatically
|
||||
# sent back to the TFW server
|
||||
return {
|
||||
'key': 'message',
|
||||
'data': {
|
||||
'originator': 'My first event handler',
|
||||
'message': f'I have received this message: {message}'
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user