jmeter websocket socket.io请求未收到Nestjs中的请求

发布于 2025-02-11 08:02:17 字数 892 浏览 1 评论 0 原文

我有一个Nestjs服务器,可以使用以下代码

const io = require('socket.io-client');
const socket = io("http://localhost:3000", {
    transports: ["websocket"],
    pingTimeout: 10000,
    pingInterval: 25000,
});
const someDelay = 10;
socket.on('connect', function () {
    console.log('connected...');
})

成功接收请求。问题是在使用Jmeter发送相同的请求时,它永远不会到达服务器

”在此处输入图像描述

打开连接后,我将带有令牌请求,并且它永远不会到达服务器

,请遵循请求 - request-response-sampler

“在此处输入图像说明”

I have a Nestjs server i am able to send connection request using the below code

const io = require('socket.io-client');
const socket = io("http://localhost:3000", {
    transports: ["websocket"],
    pingTimeout: 10000,
    pingInterval: 25000,
});
const someDelay = 10;
socket.on('connect', function () {
    console.log('connected...');
})

The request is received successfully. The issue is when sending the same request using JMETER it never reaches the server

enter image description here

after opening the connection i am sending a request with token and it never reaches server

enter image description here
It doesn't give any error but never reaches server

Following is the error on request-response-sampler

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白首有我共你 2025-02-18 08:02:17

因为您只是打开连接,所以您不会发送任何“请求”,请考虑添加单作者采样器 request-Response Sampler ,您应该看到请求“到达”服务器。

参见

Because you're only opening a connection, you're not sending any "request", consider adding either a single-write sampler or request-response sampler and you should see the request "reaching" the server.

See Basic request-response sample.jmx example test plan and JMeter WebSocket Samplers - A Practical Guide for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文