# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at <http://mozilla.org/MPL/2.0/>.

config:
    target: '<http://localhost:5000>'
    phases:
        - duration: 10
          arrivalRate: 50
    variables:
        greeting: ['hello', 'goedemorgen', 'guten tag', 'bonjour', 'hola']

scenarios:
    - name: 'A user that just lurks'
      weight: 15
      engine: 'socketio'
      flow:
          - emit:
                channel: 'join'
                data: 
                  "channelId": "1"
                  "auth": "viewer"
          - think: 5

    - name: 'A mostly quiet user'
      weight: 75
      engine: 'socketio'
      flow:
          - emit:
                channel: 'join'
                data: 
                  "channelId": "1"
                  "auth": "viewer"
          - think: 5
          - emit:
                channel: 'chat'
                data: 
                  "id": "{{$randomString()}}"
                  "type": "NORMAL"
                  "nickname": "quiet-{{ $randomString() }}"
                  "content": "{{ greeting }}"
          - think: 15

    - name: 'A chatty user'
      weight: 10
      engine: 'socketio'
      flow:
          - emit:
                channel: 'join'
                data: 
                  "channelId": "1"
                  "auth": "viewer"
          - think: 5
          - loop:
              - emit:
                    channel: 'chat'
                    data: 
                      "id": "{{$randomString()}}"
                      "type": "NORMAL"
                      "nickname": "chatty-{{ $randomString() }}"
                      "content": "{{ greeting }}"
              - think: 1
            count: 10
          - think: 15