相关链接:测试Socket.io - Artillery.io文档
我不知道如何从yaml的emit中发送两个参数,对于我的情况,这两个参数是"data"和"message",要发送到"send-room-message"。
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-->>
有什么想法吗?