I'm trying to create a socket connection to SockJS server and following the example given here but Titanium keeps on giving me the error "has no method createTCP"
This is the code I'm using
var connectingSocket = Ti.Network.createTCP({
host: host,
port: port,
connected:function(e) {
e.socket.write(Ti.createBuffer({data: "Well, hello there!"}));
},
error:function(e) {
Ti.UI.createAlertDialog({
title:"Socket error: "+e.errorCode,
message:e.error
}).show();
Ti.API.info("CONNECTION has been closed: "+e.socket.host+":"+e.socket.port);
}
});
connectingSocket.connect();