Not tested, but a potential echo + timeout example:
from diesel import Application, Service, until_eol, sleep, bytes
from websocket import WebSocket
import time
def skip_one():
yield bytes(1)
yield up(until_eol())
def hi_server():
while True:
inp, to = yield (skip_one, sleep(3))
if to:
yield '%s timeout!\n' % time.asctime()
else:
yield 'you said %s' % inp
app = Application()
app.add_service(Service(WebSocket(hi_server), 8000))
app.run()