Chat & node based websocket

------------------------review------------------------- --------
the WebSocket: data exchange
1. high performance
2. bidirectional - real-time data
3.HTML5 IE9 +
4.socket.io
cross-domain

socket.io
1. compliant
2. Binary

Socket.IO
1. how to use
2. Chat Room
3. VOD

Ajax cross domain
jsonp

Tools

------------------------------------------------------------

Background -node:
1. Native nodejs
2.nodejs framework

-------------------------------------------------- ----------
nodejs: write back with javaScript
1. high performance
2. convenient front desk with
3 for entry front-end staff

-------------------------------------------------- ----------
the Java large-scale projects
Node.js small projects, tools - intermediate level language

-------------------------------------------------- ----------
agreement:
the listen - wait for clients to connect
port - digital: distinguish between different services
1. the others never used
2.linux - only use ports above 1024
3. each service It has a default port:
Web 80
SSH 22
the FTP 21
MySQL 3306

------------------------------------------------------------

Node.js
1.工具+中间层
2.http、fs
let server = http.createServer((req, res) => {
req.url/method/host/...
res.write/end
});
server.listen(8080);

fs.readFile(path, (err, data)=>{});
fs.writeFile(path, content, err=>{});

------------------------------------------------------------

res.writeHeader() => header 200/404
res.write() => body


-------------------------------------------------- ---------
the WebSocket:
1. native very troublesome
2.socket.io compatible to IE6
3. natural cross-domain
-------------------- ---------------------------------------
chat room:
1. user registration, log
2 Statements -> others
3. offline messages

Data -> Database
1. user
2. The message

-------------------------------------------------- ---------
database:
1. relational database --MySQL, Oracle
advantages: strong (9 points)
low performance (7.5): disadvantage
2. document database --SQLite
advantages: simple
disadvantages: not support large application, particularly not store data
3. the document database --MongoDB
advantages: direct memory object itself
disadvantages: not stringent enough, the performance of low (6.5)
4. space database - coordinate, position
the NoSQL:
performance (9 )
Redis / memcached / Bigtable / Hypertable

-------------------------------------------------- ---------
the MySQL:
library - folder: the management of the data stored in itself does not
form - file: stored data
fields (columns, field)
line
type:
number:
integer tinyint (-128 ~ 127 or 0 ~ 255) int (-21 billion to $ 2.1 billion, or 0 to 43 billion)
after the floating-point decimal float-- 8, after 308 double-- decimal
string:
small string varchar (255)
large text string (2G)
primary key:
1. unique
2. high performance

Language databases: SQL
four query (CRUD) - CRUD

 

Guess you like

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