TMRAppBle/script/module/socket.js

37 lines
805 B
JavaScript
Raw Normal View History

2023-10-19 15:00:17 +08:00
var socketManager = null;
var socketUtil = {
initSocket:function(){
socketManager = api.require('socketManager');
},
createSocket:function(){
socketManager.createSocket({
host: param.host,
returnBase64: false,
port: param.port
}, function (ret, err) {
callback(ret, err);
});
},
closeSocket:function(){
socketManager.closeSocket({
sid: param.sid
}, function(ret, err) {
callback(ret, err);
});
},
writeMessage:function(){
socketManager.write({
sid: param.sid,
data: param.data,
base64: false
}, function (ret, err) {
callback(ret, err);
});
}
}
export {
socketUtil
}