开发者

Websocket for Node.js login using Socket.io

开发者 https://www.devze.com 2023-04-04 14:53 出处:网络
I\'m considering using Websockets for the login page开发者_StackOverflow社区 of a node website i\'m building. The website doesn\'t need to be widely available, so users not having websocket support do

I'm considering using Websockets for the login page开发者_StackOverflow社区 of a node website i'm building. The website doesn't need to be widely available, so users not having websocket support doesn't concern me.

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. The data will be sent in pain text but happens with an AJAX call as well. 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. If you are not using it for anything else don't bother.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号