简体   繁体   English

使用Socket.io登录Node.js的Websocket

[英]Websocket for Node.js login using Socket.io

I'm considering using Websockets for the login page of a node website i'm building. 我正在考虑将Websockets用于我正在构建的节点网站的登录页面。 The website doesn't need to be widely available, so users not having websocket support doesn't concern me. 该网站不需要广泛使用,因此没有websocket支持的用户不必担心我。

Are there any disadvantages of using something like: 使用类似的东西是否有任何缺点:

$("#submit").submit(function(){
  socket.emit('details', {u: username, p: password});
  return false;
});

In theory, it should be faster because of the smaller overhead. 从理论上讲,由于开销较小,因此应该更快。

It should be faster than a traditional AJAX call but only by a small amount. 它应该比传统的AJAX调用快,但速度要小一些。 The data will be sent in pain text but happens with an AJAX call as well. 数据将以痛苦文本发送,但也会通过AJAX调用发生。 There really is no down side but there isn't much of an upside either. 确实没有不利的一面,但也没有太多的利空。 Do whatever fits with the rest of the project. 做适合项目其余部分的一切。 If you are using socket.io across the board then it makes a lot of sense. 如果您要全面使用socket.io,那么这很有意义。 If you are not using it for anything else don't bother. 如果您没有将其用于其他任何用途,请不要打扰。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM