TMRAppBle/script/module/socket.js

37 lines
805 B
JavaScript

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
}