Summary of the simple chat room series based on node. js

Source: Internet
Author: User

finish this chat room.DemoIt took about one weeks, of course one weeks to just refer to the coding work. The pre-knowledge reserves are from0to the1from scratch, spent a certain amount of time familiarnode. jsthe basic syntax andnode. jsand theMongoDBThe process of interacting with each other. DemoThe problem is thatSocket.iothe operating mechanism, from theSocket.iobind to ServerServerboth the server and the client are using theEmitand the onmethod to handle the custom event. The following points are respectively highlighted in the above explanations.

node. js

node. jsCreate a server and perform a similar background language operation. Recently, also in contact withC #, and I've learned about it before .PHP. The main function of the background language is to read and write the database, the write operation is to receive the front-end interface transmitted by the relevant data, through the database statements to insert data into the database, now understand theSQLand theMongoDB, the former is a typical relational database,SQLlanguages can be embedded in the background language, andnode. jsOperationMongoDBis throughMongooseCreate aModel, performModelof theSavemethod to save the data to the database, and the read operation is to query the data in the database based on the parameters passed by the front-end interface, and return the results to the front end.

Mongodb

as a relational and non-relational database, its query statements are unusually simple and less complex and cumbersome than SQL . Plan to continue learning node. jsandstill use MongoDB to match it. The only drawback is that it takes up hard disk resources.

Socket.io

Socket.io encapsulates the websocket and other real-time communication in HTML5, and its internal mechanism is not very complicated. The main is the real-time communication, syntax is very simple. The official online demo can be coded one or two times.

through this the completion of the Demo, Bishi is also over. The fact that the code was written and debugged didn't take much time, and the paper took a lot of time. When you understand the routing capabilities of node. js and how the socke.io Works, there's no big problem.

Summary of the simple chat room series based on node. 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.