Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whistle中执行script使用无法使用lz4 #1185

Open
muyik opened this issue Dec 11, 2024 · 3 comments
Open

whistle中执行script使用无法使用lz4 #1185

muyik opened this issue Dec 11, 2024 · 3 comments

Comments

@muyik
Copy link

muyik commented Dec 11, 2024

image
但是本地使用nodejszhi xing执行是正常的,
whistle中脚本是这样的
`const protobuf = require("/usr/local/lib/node_modules/protobufjs");
const lz4 = require('/usr/local/lib/node_modules/lz4');

exports.handleWebSocket = async (ws,connect) => {
const res = await connect();
ws.on('message', (data) => {
res.send(data)
console.log('client send');
});
res.on('message', (data) => {

   ws.send(data)
   
});
 ws.on('error', (err) => {
  console.error('Client Error:', err);
});

ws.on('close', (code, reason) => {
  console.log('Client Closed:', { code, reason });
});

res.on('error', (err) => {
  console.error('Server Error:', err);
});

res.on('close', (code, reason) => {
  console.log('Server Closed:', { code, reason });
});
ws.on("ping", function heartbeat() {
   console.log('444')
  ws.pong();
})

};`

@avwo
Copy link
Owner

avwo commented Dec 11, 2024

whistle.script 用 vm 执行代码,可能 vm 不支持运行这个模块,你自己写个插件试试

@muyik
Copy link
Author

muyik commented Dec 11, 2024

whistle.script 用 vm 执行代码,可能 vm 不支持运行这个模块,你自己写个插件试试

小白一个,再请教下是写一个类似script得这个插件吗?

@avwo
Copy link
Owner

avwo commented Dec 19, 2024

不需要像 script 那么通用,按自己业务需要写一个简单的即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants