artilleryio / artillery-core

artillery-core - deprecated
Mozilla Public License 2.0
29 stars 104 forks source link

Add socketio query param on connect event #195

Open MaxOvcharov opened 7 years ago

MaxOvcharov commented 7 years ago

Hi

I am trying to use artillery to test my socket.io server under artillery 1.6.0-2. I want to put query param while connecting to server. My artillery config file:

config:
  target: "http://127.0.0.1:8000"
  phases:
    - duration: 28800
      arrivalRate: 1
  variables:
    var: ['1', '2']
  processor: "./functions.js"
  socketio:
    query: 'user_id=4f5bc00e-8516-49a9-8507-d475d40d06b5&session_id=4f5bc00e-8516-49a9-8507-d475d40d06b5'

scenarios:
  - name: "Connect and send a bunch of messages"
    weight: 100
    engine: "socketio"
    flow:
      - loop:
          - function: "setMessage"
          - emit:
              channel: 'sendMessage'
              data: {
                'user_id': "4f5bc00e-8516-49a9-8507-d475d40d06b5",
                'session_id': "4f5bc00e-8516-49a9-8507-d475d40d06b5",
              }
              namespace: "/chat_v1"
          - think: 4
        count: 1

Here is a simple Socket.io server on Python:

from sanic import Sanic

import socketio

sio = socketio.AsyncServer(async_mode='sanic')
app = Sanic()
sio.attach(app)

@sio.on('sendMessage', namespace='/chat_v1')
async def test_message(sid, message):
    print(message, '\n\n')

@sio.on('connect', namespace='/chat_v1')
async def test_connect(sid, environ):
    print(environ)

@sio.on('disconnect', namespace='/chat_v1')
def test_disconnect(sid):
    print('Client disconnected')

if __name__ == '__main__':
    app.run()

When section with socketio param is activated there are no messages in sendMessage event. But if you remove this param every thing works fine.

MaxOvcharov commented 7 years ago

I have no idea how does it works and when query param initialised into artillery socketio client? Can you help me?

MaxOvcharov commented 7 years ago

@hassy Can you help me with my problem?

hassy commented 7 years ago

I haven't been able to reproduce the issue (with a Node.js based server though). That doesn't mean there isn't an issue in Artillery, but I haven't had the time to look into it further.