大佬教程收集整理的这篇文章主要介绍了node.js – 如何在节点服务器中使用sails.io.js版本0.11.3,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试过这个例子,但没有使用sail v0.11.3
https://github.com/sgress454/sailsChat
这是我已经完成的代码,但我不知道我应该把它放在哪里,当我把它放在config目录中的sockets.js文件中时它不起作用
// Set some options: // (you have to specify the host and port of the Sails BACkend when using this library from Node.js) io.sailS.Url = 'http://localhost:9002'; // ... io.socket.on('connect',function socketConnected() { console.log('connect..'); }); // Send a GET request to `http://localhost:1337/Hello`: io.socket.get('/Hello',function serverResponded (body,JWR) { // body === JWR.body console.log('Sails responded with: ',body); console.log('with headers: ',JWR.headers); console.log('and with status code: ',JWR.statusCodE); // When you are finished with `io.socket`,or any other sockets you connect manually,// you should make sure and disconnect them,e.g.: io.socket.disconnect(); // (note that there is no callBACk argument to the `.disconnect` method) });
请指导我这个.
以上是大佬教程为你收集整理的node.js – 如何在节点服务器中使用sails.io.js版本0.11.3全部内容,希望文章能够帮你解决node.js – 如何在节点服务器中使用sails.io.js版本0.11.3所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。