コード例 #1
0
ファイル: httpserver.py プロジェクト: quehanwei/money-online
    # httpd.allChars = ('a','b','c')#all available chars for selection
    # httpd.selectedChars =[] #a list to store selected chars
    # httpd.movingCharIndex = 0 # the index of the char that is moving at the moment, pls note it's index, not the char itself

    def reply(self, strOut):  # format and send out response
        self.send_response(200)
        self.end_headers()
        print('replying:', strOut)
        self.wfile.write(strOut.encode('UTF-8'))

    def log_message(self, format, *args):
        return


httpd = HTTPServer(('localhost', 10000), SimpleHTTPRequestHandler)
httpd.charAssignment = {}  # stores the character, and it's IP, pendingAction list; the key is the character name,
# e.g. 1/2/3...
httpd.allChars = ('a', 'b', 'c')  # all available chars for selection
httpd.selectedChars = []  # a list to store selected chars
httpd.movingCharIndex = 0  # the index of the char that is moving at the moment, pls note it's index, not the char itself

threading.Thread(target=httpd.serve_forever).start()


def wsConsumer(message):
    print('wxConsumer:', message)


def wsProducer():
    print('wxProducer')
    return 'wsProducer'