Socket.io Client for Appcelerator (Titanium Application iOS)

I am building a Titanium based mobile application (iOS) in Appcelerator and want to connect it to Node.js(Socket.io) based server. For that I need a client side socket.io file which.

I tried to import the client side JS using 'require',

var io = require('socket.io'); //JavaScript Downloaded from here: https://github.com/socketio/socket.io-client/blob/master/socket.io.js

var socket = io.connect('http://localhost:3000');

I am getting the following error: Script Error: Module "socket.io" failed to leave a valid exports object

Please let me know where I am going wrong or what is the way to use socket.io in Appcelerator.

Thanks In Advance.

链接地址: http://www.djcxy.com/p/63190.html

上一篇: TypeError:$在调用jQuery函数时不是函数

下一篇: 适用于Appcelerator的Socket.io客户端(Titanium应用程序iOS)