是否将WebSocket连接到侦听端口Ti.Network.Socket.TCP?

是否将WebSocket连接到侦听端口Ti.Network.Socket.TCP?,websocket,titanium,Websocket,Titanium,我正在尝试将浏览器中的WebSocket连接到基于钛的iOS应用程序上的侦听套接字服务器 设备和浏览器在同一个无线路由器上,但我只能得到 [16:01:09.282]Firefox无法与位于ws://192.168.0.190:8080/的服务器建立连接 这与协议“ws://”有关吗?钛套接字侦听器如何知道期望该协议 这是我的钛合金插座代码: var hostname = Ti.Platform.address; //Create a socket and listen for incomin

我正在尝试将浏览器中的WebSocket连接到基于钛的iOS应用程序上的侦听套接字服务器

设备和浏览器在同一个无线路由器上,但我只能得到

[16:01:09.282]Firefox无法与位于ws://192.168.0.190:8080/的服务器建立连接

这与协议“ws://”有关吗?钛套接字侦听器如何知道期望该协议

这是我的钛合金插座代码:

var hostname = Ti.Platform.address;

//Create a socket and listen for incoming connections
var listenSocket = Ti.Network.Socket.createTCP({
    host : hostname,
    port : 8080,
    accepted : function(e) {
        // This where you would usually store the newly-connected socket, e.inbound
        // so it can be used for read / write operations elsewhere in the app.
        // In this case, we simply send a message then close the socket.
        Ti.API.info("Listening socket <" + e.socket + "> accepted incoming connection <" + JSON.stringify(e.inbound) + ">");
        e.inbound.write(Ti.createBuffer({
            value : 'Hi from iOS.\r\n'
        }));
//        e.inbound.close();
        // close the accepted socket

    },
    error : function(e) {
        Ti.API.error("Socket <" + e.socket + "> encountered error when listening");
        Ti.API.error(" error code <" + e.errorCode + ">");
        Ti.API.error(" error description <" + e.error + ">");
    }
});
// Starts the socket listening for connections, does not accept them
listenSocket.listen();
Ti.API.info("Listening now...");

// Tells socket to accept the next inbound connection. listenSocket.accepted gets
// called when a connection is accepted via accept()
Ti.API.info("Calling accept.");
listenSocket.accept({
    timeout : 10000
});

你看到这个了吗?我确实看到了。但是,我认为这是一个类似WebSocket的客户端,而不是服务器,对吗?我想在iOS上运行WebSocket服务器并从浏览器连接。我已经开始将其包装到钛模块中:
function sensorClient(host, port) {
    if ("WebSocket" in window) {
        alert("WebSocket is supported by your Browser!");
        // Let us open a web socket
        var ws = new WebSocket("ws://" + host + ":" + port);
        ws.onopen = function () {
            // Web Socket is connected, send data using send()
            ws.send("hi from the browser");
        };
        ws.onmessage = function (evt) {
            var received_msg = evt.data;
            alert("Message received..." + received_msg);
        };
        ws.onclose = function () {
            // websocket is closed.
            alert("Connection is closed...");
        };
    }
    else {
        // The browser doesn't support WebSocket
        alert("WebSocket NOT supported by your Browser!");
    }
}