Esempio n. 1
0
def init_project():
    server = WebSocketServer('127.0.0.1',
                             8000,
                             WafcamSocket,
                             select_interval=None)
    launch(test_config, server)
    server.serve_forever()
def runserver(socket_port, websocket_port):

    SOCKET_PORT = socket_port
    WEBSOCKET_PORT = websocket_port

    server = WebSocketServer('', WEBSOCKET_PORT, Bridge)
    server.serve_forever()
Esempio n. 3
0
class UnityServer:
    def __init__(self, host: str, port: int):
        self.logger = logging.getLogger("Unity Streamer")
        self.host = host
        self.port = port
        self.server = WebSocketServer(self.host, self.port,
                                      SimpleUnityWebsocketServer)
        self.thread = threading.Thread(target=self.start, args=())

        self.logger.debug("Unity Server Initiated")

    def get_control(self):
        c = VehicleControl(throttle=throttle, steering=steering)
        return c

    def update_frame(self, new_frame):
        global frame
        frame = new_frame

    def start(self):
        self.logger.debug("Unity Server Started")
        self.server.serve_forever()

    def shutdown(self):
        self.server.close()
        self.thread.join()

    def startAsync(self):
        self.thread.start()
Esempio n. 4
0
class AnkiSocketServer(QThread):
    msgHandler = pyqtSignal(str)

    def run(self):
        global PORT
        self.server = WebSocketServer('', (PORT + 1), SimpleAnki)
        print("AnkiSocketServer run on port: " + str(PORT + 1))
        self.server.serve_forever()
Esempio n. 5
0
def init_project():
    db_config = database_utils.read_env()
    server = WebSocketServer('127.0.0.1',
                             8000,
                             WafcamSocket,
                             select_interval=None)
    launch(db_config, server)
    server.serve_forever()
Esempio n. 6
0
            if jsn['value'] is not None:
                self.__i = jsn['value']
                self.send_message('{"success": True}')
                self.f()

        except Exception as e:
            print('???', e)

    def connected(self):
        print(self.address, 'connected')

    def handle_close(self):
        print(self.address, 'closed')

    def f(self):
        print('f', self.__i)
        self.__i += 1
        self.send_message('{"value": ' + str(self.__i) + '}')

        t = threading.Timer(0.2, self.f)
        t.start()


if __name__ == "__main__":
    server_address = ''
    server_port = 8000
    server = WebSocketServer(server_address, server_port, SimpleEcho)

    print('serving at %s:%d' % (server_address, server_port))
    server.serve_forever()
def server_thread(port):
    server = WebSocketServer('', port, ws_Server)
    print ("Starting Web socket server")
    server.serve_forever()  
def main():
    server = WebSocketServer('127.0.0.1', 8009, SimpleEcho)
    server.serve_forever()
Esempio n. 9
0
def work(data):
    server = WebSocketServer('0.0.0.0', 5124, SimpleEcho, data)
    server.serve_forever()
Esempio n. 10
0
def runServer():
    print("Main:: Started backend WS server. Listening at port: 8765")
    server = WebSocketServer('192.168.0.122', 8765, WSServer)
    server.serve_forever()