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