You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
584 B
Python
26 lines
584 B
Python
7 years ago
|
|
||
|
# The service framework will fundamentally change (i.e. become much nicer, and
|
||
|
# hopefully lose those hard-coded magic numbers somehow), but meanwhile this is
|
||
|
# a taster of how it looks today.
|
||
|
|
||
|
import time
|
||
|
|
||
|
import mitogen
|
||
|
import mitogen.service
|
||
|
import mitogen.unix
|
||
|
|
||
|
|
||
|
class PingService(mitogen.service.Service):
|
||
|
well_known_id = 500
|
||
|
max_message_size = 1000
|
||
|
|
||
|
def dispatch(self, dct, msg):
|
||
|
return 'Hello, world'
|
||
|
|
||
|
|
||
|
@mitogen.main()
|
||
|
def main(router):
|
||
|
listener = mitogen.unix.Listener(router, path='/tmp/mitosock')
|
||
|
service = PingService(router)
|
||
|
service.run()
|