You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
zh-cn/sekiro-article/sekiro-js-3/
什么是jsRPC RPC指远程过程调用,APP里面的RPC大家比较熟悉了。
那什么是jsRPC,顾名思义,就是指利用js手段实现代码远程控制浏览器控制台的一种手段,需要借助websocket实现。
下面我们先简单的写一个小例子:
var ws = require('nodejs-websocket'); console.log('开始建立连接...'); var cached = {} var server = ws.createServer(function (conn) { conn.on('text', function (msg) { var key = conn.key console.log("将要发送代码:【" + msg + "】至浏览器/python"); server.connections.forEach(conn => { conn.send(msg); }) }) conn.on('close', function (code, reason) { console.log('关闭连接', code, reason) }); conn.on('error', function (code, reason) { console.log('异常关闭', code, reason) }); }).listen(8015) console.log('WebSocket建立完毕'); var ws = require('nodejs-websocket'); console.log('开始建立连接...'); var cached = {} var server = ws.
http://154.39.149.86:5612/zh-cn/sekiro-article/sekiro-js-3/
Beta Was this translation helpful? Give feedback.
All reactions