0

我是 socket.io 的新手,只知道简单的 websocket。我想测试使用 socket.io v4 构建实时通信通道的功能的性能。

推送消息的其余api:

curl --location --request POST 'https://ws.endpoint' \
--header 'Authorization: Bearer {token}
--data-raw '{
    "topic" : "all",
    "payload" : {}
}'

我研究并遵循了https://socket.io/docs/v4/load-testing/https://github.com/ptejada/artillery-engine-socketio-v3上的指南,但返回连接失败。

这是我的 yaml 文件:

config:
  target: "wss://websocket.endpoint"
  phases:
    - duration: 10
      arrivalRate: 5
  engines:
    socketio-v3: 
    transports: ["websocket"]

scenarios:
  - name: My first scenario
    engine: socketio-v3
    flow:
      # wait for the WebSocket upgrade (optional)
      - think: 1

      #- emit:
       #   channel: "all"
        #  data: "Hello from Artillery"
    #  response:
        #    channel: "all"
          #  data: "Hello from Artillery"

      - emit: ["join", "all"]

      - emit: ["message", "all", "Hello from Artillery"]
    response:
            channel: "all"
            data: "Hello from Artillery" 

我尝试使用 jmeter,但它也无法与 websocket 端点连接。

会喜欢任何提示。

4

0 回答 0