---
# System prepended metadata

title: Untitled

---

```yaml=
config:
  variables:
    apiKey: "b0ecbb083bdff7314b61de4a03091481820ddfe6eb636878"
  target: "https://loadtest-api-v2.upstra-next.ekomedia.technology"
  engines:
    quiwsth-socket: {}
  SocketDynamic:
    transports: ["websocket"]
  phases:
     - duration: 60 ## sec
       arrivalCount: 5
  plugins:
    expect: {}
  processor: 'functional.js'
scenarios:
#### [SCENARIO-2]  
  - name : "connect - query - send message - leave"
    engine: "quiwsth-socket"
    flow:
      - function: "genUser"
      - think : 10
#### generate access token
      - post:
          url: "/v1/device"
          headers:
            x-api-key : "{{ apiKey }}"
          json:
            userId: "{{ userId }}"
            deviceId: "{{ deviceId }}"
            deviceInfo: {
              kind: "web",
              model: ""
            }
          capture:
            - json: "$.accessToken"
              as: "accessToken"
          expect:
            - statusCode: 200
      - think : 10
      - emit:
          channel: "channel.getInactiveChannelIds"
          data: {}
      - think : 10
#### query chanel list
      - emit:
          channel: "v3/channel.query"
          data: {}
          acknowledge:
            match:
              json: "$.0.status"
              value: "success"
      - think: 10
#### join channel
      - emit:
          channel: "v3/channel.join"
          data: {
            channelId: "{{ channel }}",
            type: "standard",
          }
          acknowledge:
            match:
              json: "$.0.status"
              value: "success"
      - think: 10
#### query message list
      - emit:
          channel: "v3/message.query"
          data: {
            channelId: "{{ channel }}"
          }
          acknowledge:
            match:
              json: "$.0.status"
              value: "success"
      - think: 300 ## simulate user will take 5 min to read message before send it
      - think: 10
      - function: "genMessageId"
      - emit:
          channel: "v3/message.create"
          data: {
            channelId: "{{ channel }}",
            type: "text",
            data: {
              text: "{{ userId }} I send message from artillery !"
            },
            messageId: "{{ msgId }}"
          }
          acknowledge:
            match:
              json: "$.0.status"
              value: "success"
      - think: 10
#### leave channel
      - emit:
          channel: "v3/channel.leave"
          data: {
            channelId: "{{ channel }}",
          }
          acknowledge:
            match:
              json: "$.0.status"
              value: "success"
```