我必须打开套接字连接(NB不是websocket)。 我试过使用这个插件:https://github.com/blocshop/sockets-for-cordova。 它在Android和iOS中运行良好,但Windows Phone 10不支持。
socket = new Socket();
socket.open(
ipAddress,
port,
function () {
// invoked after successful opening of socket
console.log("connected");
},
function (errorMessage) {
// invoked after unsuccessful opening of socket
console.log(errorMessage);
});
socket.onData = function (data) {
// invoked after new batch of data is received (typed array of bytes Uint8Array)
var message = new TextDecoder("utf-8").decode(data);
console.log("message ", message);
}
socket.onClose = function (hasError) {
console.log("close");
}
socket.onError = function(errorMessage) {
// invoked after error occurs during connection
console.log(errorMessage);
};
编辑:问题是:有人知道如何在Windows平台的Phonegap中创建套接字连接吗? (其他插件)