1
我有一个任务实现基于聊天的应用程序访问服务器上使用Web服务API调用可用的私人数据。显示所有可用用户从Web服务器,并与这些人聊天。钛开发的可能性不大支持iPhone/Android聊天应用程序。如果可能的话,让我指导实施。钛聊天实现
我有一个任务实现基于聊天的应用程序访问服务器上使用Web服务API调用可用的私人数据。显示所有可用用户从Web服务器,并与这些人聊天。钛开发的可能性不大支持iPhone/Android聊天应用程序。如果可能的话,让我指导实施。钛聊天实现
是的,当然这是可能的。有一百万种方法可以做到这一点,你的问题不是很清楚。
如果它完全基于web服务的then just use this.
继承人发布到Web服务发送一个JSON对象的一个简单的例子:
var getChatMessages = Ti.Network.createHTTPClient({
onload : function(e) {
var doSomethignWithThis = this.responseText;
},
onerror : function(e) {
Ti.API.info(this.responseText);
Ti.API.info('SelectActivityStepsByKeyList webservice failed with message : ' + e.error);
}
});
getChatMessages.open('POST', 'http://yourchatserver/GetChats');
getChatMessages.setRequestHeader("Content-Type", "application/json");
getChatMessages.send({"message" : "How is everyone today?", "user" : "[email protected]});
这并不难钛,难的是在服务器端。 Here is an example project that accomplishes chat through the use of the socket.io library.这对你来说可能是更好的方法。该链接有一个如何工作的视频以及完整的源代码。
如何执行示例代码来测试..你可以给我一些细节 –
看看我给的链接:完整的代码在这里https://github.com/euforic/ChatSocks#readme –