python websocket模拟客户

发布时间:2019-08-30 09:29:51编辑:auto阅读(1964)

    ##注意要安装 pip install websocket-client
    from websocket import create_connection
    ws = create_connection("ws://127.0.0.1:9002")
    ws.send("Hello, World")##发送消息
    result = ws.recv()##接收消息
    ws.close()

关键字