search

Home  >  Q&A  >  body text

node.js - How to protect the nodejs websocket process, in addition to making the code more rigorous

Nodejs is a single process. The general method is to use a daemon process. As far as I know, there is a nodemon library that will be automatically opened when the machine is down. However, this method is not applicable to websockets. Even if the daemon process is restarted, the previous socket will be no longer available. It crashes. Although the server is guaranteed to be normal, it still affects the user experience. Should we try to catch all possible problems? If a third-party library is called in the socket, this method of plugging the loophole seems impossible to execute perfectly.

天蓬老师天蓬老师2800 days ago828

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 13:39:34

    At this time, the client also needs to have a local cache of reconnection and key information. Other information that needs to be maintained can be cached on the server at any time

    reply
    0
  • Cancelreply