Home > front end >  Ask a lot and NPM heat instead of the problem?
Ask a lot and NPM heat instead of the problem?

Time:09-17

Looking for websocket components based on nodejs, find the ws and socket. IO,
Found on the lot, the socket. The number of IO star is 49 k, far more than the ws is 14 k, but look from the downloads of NPM, ws is far more than socke. IO,

Why is this so, which component is more popular?





CodePudding user response:

Socket. IO can only use the socket. IO service (background), the limit is larger,
Websocket can use other service

CodePudding user response:

reference 1st floor jio can reply:
socket. IO can only use the socket. The IO service (background), the limit is larger,
Websocket can use other service

I don't understand, websocket can use other services, is to point to? Such as?

CodePudding user response:

Websocket can build ws/WSS background herself, services, and other third-party socket plug-in, socket. IO must use socket. IO - client connection sokcet. IO - server.

CodePudding user response:

reference jio can reply: 3/f
websocket can build ws/WSS background herself, services, and other third-party socket plug-in, socket. IO must use socket. IO - client connection sokcet. IO - server.

This I don't think that is a big problem, actually choose websocket components, mainly choose the back-end, front, it is very simple, modern browsers default support, so we should choose who, or main consideration how back-end functionality,

CodePudding user response:

Combined with you, in the making and the differences of NPM, personal analysis of the reason is:
1, making the focus is to understand more on technology, may socket. IO relatively, know more but with less
2, because the stock of the old system, therefore, compatible with IE browser total demand is very big, can only use the socket on the old system. IO, the stock is a big demand, especially the Internet, many users still use the old IE,
2, the statistics on the NPM, ws far above the socket. IO, perhaps because its statistical contains the NPM dependence on all levels in the call, is not only the company eventually project will use the ws, along with the NPM on using the open source components, component is invoked, also the number of download count ws, ws more clean and light, is more as dependent libraries use of open source components, and it is conceivable that the socket. IO can only be used in the final project, and are less likely to be used in open source components,

Based on this, I choose the ws, the reason is:
1, I don't need to consider the foreseeable future, compatible with IE
2, ws more lightweight, better performance
  • Related