webSocket chat room set up complete


Prevent:
Wesocket two-way communication socket.io-- compatible
node server
database MySQL
1.node operation database:
mysql.createConnection
mysql.createPool
2.SQL statement
four major basic statement - CRUD

By: insert into the list table field values (values)
the INSERT the INTO user_table (username, password, Online) the VALUES ( 'YY', 'QQ',. 1);

删:DELETE FROM 表 WHERE 条件
DELETE FROM user_table WHERE username = 'YY'

Change: UPDATE SET table = new value field conditions
UPDATE user_table SET password = '111111' WHERE username = 'yuan'

Zha: SELECT FROM table field conditions where
the SELECT username, the WHERE `online` Online FROM user_table. 1 =
----------------------------- --------------------------------------------------
Interface:
user registration:? / REG user = XXX & pwd = XXX
{ 'code': 0, 'MSG': 'information'}
user login:? / Login user = XXX & pwd = XXX
{ 'code': 0, 'MSG': 'information'}

-------------------------------------------------- -----------------------------
The first request: request file
/1.html
/1.js
second request: request file
/ login? xxx

-------------------------------------------------------------------------------
ws 接口
‘reg’, (username, pass) "reg_ret":{code: 0, msg:"XXXXX"}
'login', (username, pass) "login_ret": {code: 1, msg: "XXXXXXX"}

 

Guess you like

Origin www.cnblogs.com/caicai521/p/11262107.html