的阿哥的 msg.py
#!/usr/bin/local/python
# -*- coding: utf-8 -*-
import socket
import websocket
from websocket import _app as WebsocketApp
from websocket import _socket as socket
# import thread
import threading
import time
import json
import os
def on_message(ws,message):
resDic = json.loads(message)
resDictype = resDic["Type"]
print(resDictype)
# resDicTrip = resDic["TripID"]
# print resDicTrip
def run_ws():
url = 'ws://192.168.2.22:32080/wsconnect?appkey=AK-smoke&appsecret=SK-smoke&debug=true'
ws = WebsocketApp.WebSocketApp(url,on_message=on_message)
ws.run_forever()
if __name__== "__main__":
t = threading.Thread(target=run_ws)
t.setDaemon(True)
t.start()
time.sleep(30)
# -*- coding: utf-8 -*-
import socket
import websocket
from websocket import _app as WebsocketApp
from websocket import _socket as socket
# import thread
import threading
import time
import json
import os
def on_message(ws,message):
resDic = json.loads(message)
resDictype = resDic["Type"]
print(resDictype)
# resDicTrip = resDic["TripID"]
# print resDicTrip
def run_ws():
url = 'ws://192.168.2.22:32080/wsconnect?appkey=AK-smoke&appsecret=SK-smoke&debug=true'
ws = WebsocketApp.WebSocketApp(url,on_message=on_message)
ws.run_forever()
if __name__== "__main__":
t = threading.Thread(target=run_ws)
t.setDaemon(True)
t.start()
time.sleep(30)
浙公网安备 33010602011771号