Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@liqt/mocksocket
Advanced tools
chokidar在监听到 mock/socket.js 文件改变时,重新获取文件import-fresh, 执行回调去起一个ws
1 安装
npm install mocksocket -g
2 在工程下创建 mock
文件夹,在其内编写 socket.js
文件,注意返回的对象使用JSON.stringify()
进行包裹
socket.js 文件格式即为普通的 commonjs 文件,底层使用 require 语法引入,需符合 commonjs 语法
module.exports = {
port: 1234, // 端口号,会占用本地机器的此端口号进行ws
sendHandler: (ws) => {
setInterval(() => {
ws.send(JSON.stringify({ name: 'dashixiong' }));
}, 1000); // 每秒推送一次数据
}, // 模拟数据的函数,传入ws参数,使用send向客户端发送数据,可在此函数内使用setTimeInterval来增加模拟的复杂性
};
3 执行脚本
mocksocket;
FAQs
mock socket
We found that @liqt/mocksocket demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.