Node Chat program Instance 06:server.js

Source: Internet
Author: User

Vousiu

Source: Http://www.cnblogs.com/vousiu

This example refers to the book "node. js in action" from Mike Cantelon and others.

Server.js

As I said earlier, I think the cache here can not be passed in as a parameter. It is not affected here because it is a pass-through reference. However, if a parameter is passed, the value of the cache is not up-to-date because the first function in the async queue is not running when the next asynchronous function joins the asynchronous queue, and when it runs the cache value is changed, and then the parameter value of the asynchronous function is still the old value, which will result in redundant read hard disk.

Finally put the contents of the Package.json:

{  "name": "Chatroom",  "version": "0.0.1",  "description": "Chat server",   "Dependencies": {    "Socket.io": "~0.9.6",    "MIME": "~1.2.7"  }} 

Node Chat program Instance 06:server.js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.