2021-11-03 RD5 learn orm ws netcall

ORM

Object-Relational Mapping
把关系数据库的表结构映射到对象上

WebSocket

  • 服务端
    node 启动服务,websocket可以通过httpServer和koa使用一个端口
const WebSocket = require('ws')
const WebSocketServer = WebSocket.Server
const wss = new WebSocketServer({
    port: 3000
})
wss.on('connection', function (ws){
    console.log(`[SERVER] connection()`)
    ws.on('message', function (message){
        console.log(`[SERVER] Received: ${message}`)
        ws.send(`ECHO: ${message}`, (err)=>{
            if(err){
                console.log(`[SERVER] error: ${err}`)
            }
        })
    })
})
  • 客户端
    借助js代码,控制台都行
// 打开一个WebSocket:
var ws = new WebSocket('ws://localhost:3000/test');
// 响应onmessage事件:
ws.onmessage = function(msg) { console.log(msg); };
// 给服务器发送一个字符串:
ws.onopen = ()=>{
    ws.send('Hello!');
})

Netcall

网易云信,音视频通话,视频质量需要客户端与服务端共同生效

  • Class: Netcall
  • 接口 AVChatVideoQuality

你可能感兴趣的:(2021-11-03 RD5 learn orm ws netcall)