相关:测试Socket.io - Artillery.io文档
我不知道如何发送两个参数,在我的例子中,从yaml发出的“数据”和“按摩”到“发送房间消息”。
Socket.io
socket.on('send-room-message', function (data, message) {
socket.broadcast.to(data.room).emit('get-room-message', data, message);
});socketio-chat-load-test.yaml
config:
target: "http://localhost:3030"
phases:
- duration: 5
arrivalRate: 100
variables:
greeting: ["hello", "goedemorgen", "добрый день", "guten tag", "bonjour", "hola"]
variables:
room:
- 2
scenarios:
- name: "A user that just talks"
weight: 75
engine: "socketio"
flow:
- get:
url: "/"
- emit:
channel: "add-user"
data: {"id": "112312", "Name":'Hello'}
- emit:
channel: "join-room"
data: "2"
- emit :
channel: "push-room-button"
data: "2"
response:
channel: "room-busy"
data: "2"
- emit:
channel: "send-room-message"
data: <<--TODO-->>有什么想法吗?
发布于 2017-11-20 10:09:21
这目前没有炮兵的支持。不过,我找到了一个办法。你要做的是:
engine_socketio.jssocketio.emit(...)消息:
const splitData =ougoing.data.split(‘AC.26’);socketio.emit(outgoing.channel,...splitData);artillery-core更改为:"artillery-core": "git://github.com/YOUR-GITHUB-USERNAME/artillery-core.git#YOUR-BRANCH",npm link,以便使用命令行中更新的火炮核心版本。现在,当您使用火炮时,您可以在socketio load-test.yaml中指定这样的多个参数:
- emit:
channel: "Insert your channel here"
data: "Insert first parameter here|Insert second parameter|Third parameter"https://stackoverflow.com/questions/45958501
复制相似问题