diff options
Diffstat (limited to 'module/remote/wsbackend/EventHandler.py')
-rw-r--r-- | module/remote/wsbackend/EventHandler.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/module/remote/wsbackend/EventHandler.py b/module/remote/wsbackend/EventHandler.py new file mode 100644 index 000000000..deab25a6c --- /dev/null +++ b/module/remote/wsbackend/EventHandler.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +############################################################################### +# Copyright(c) 2008-2012 pyLoad Team +# http://www.pyload.org +# +# This file is part of pyLoad. +# pyLoad is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Subjected to the terms and conditions in LICENSE +# +# @author: RaNaN +############################################################################### + +from mod_pywebsocket.msgutil import receive_message, send_message + +class EventHandler: + + def __init__(self, api): + self.api = api + + def do_extra_handshake(self, req): + pass + + def transfer_data(self, req): + + while True: + try: + line = receive_message(req) + except TypeError: # connection closed + return + + print "Got", line + send_message(req, "You send: %s" % line) + + def passive_closing_handshake(self, req): + print "Closed", req
\ No newline at end of file |