ptejada / artillery-engine-socketio-v3 Goto Github PK
View Code? Open in Web Editor NEWSocket.IO v3 engine for Artillery
License: Mozilla Public License 2.0
Socket.IO v3 engine for Artillery
License: Mozilla Public License 2.0
acknowledge:
capture:
json: "$.protocol"
as: "ack"
- log: "Acknowledgement == {{ack}}"
Form the code I When i emit message with ' channel : "command" and event: "command"'. I got message "Acknowledgement == {"value":"","failed":true}"
but i check socket.io server emit was success. How to Fix it this is example acknowledge result with json type
{
"protocol": {
"version": "1",
"command": "ack",
"invoke": "1",
"qos": "normal",
}
}
Here's how i'm using the config, i enabled debug logs and i don't see query parameters being passed in the request.
config:
target: "MY_URL"
phases:
- duration: 60
arrivalRate: 5
engines:
socketio-v3:
transports: ["websocket"]
query:
Authorization: "MY_TOKEN"
i want to load test my socket.io ver 3 application, is there any brief way actually to install and use this package .
Hi @ptejada ,
I'm trying to pass extra headers by using:
scenarios:
- engine: socketio-v3
socketio:
extraHeaders:
Cookie: "test=123456"
....
But this is not working, console.log
from server-side always returns undefined
Do you have any idea on this?
Thank you
Is it possible to override query
in beforeRequest
?
I want to provide a dynamic value in query, that changes between each request but I couldn't find a way to do it.
Any idea how to do it ?
config:
payload:
path: "credentials.csv"
fields:
- "secretToken"
engines:
socketio-v3:
parser: msgpack
query:
token: {{ secretToken }}
This plugin does not support getting a secretToken
from context.vars
or from a credentials.csv
file. It only supports a single hard-coded token for one user. If an app follows best practices and requires a token up front in order to establish the connection, then this plugin only supports a single user. You can have many different instances of that user, but they all must be the same user. For apps where this is considered a security violation, (one connection per user) then this design flaw is a showstopper. Anybody know a way around this limitation?
I tried using the reconnect:true
option, but it still has to reconnect using the hard-coded secretToken instead of a dynamic value as implied in the (non-functional) code above.
I'm doing simple load test on netty-socketio Java, here when I run the load test I get "Client connected" message but looks like flows are not getting executed (I don't see any message in console after Client Connected) and all requests are getting timed out
Output
errors.Error: timeout: ......................................................... 425
vusers.created: ................................................................ 425
vusers.created_by_name.My sample scenario: ..................................... 425
vusers.failed: ................................................................. 425
loadtest.yml
config:
target: "ws://localhost:9093"
ws:
maxRedirects: 25
phases:
- duration: 20
arrivalRate: 5
rampTo: 10
name: "Warming up"
- duration: 5
arrivalRate: 10
rampTo: 100
name: "Max load"
engines:
socketio-v3: { }
scenarios:
- name: My sample scenario
engine: socketio-v3
flow:
- emit: ["data"]
Java
@Component
public class ServerCommandLineRunner implements CommandLineRunner {
private final SocketIOServer server;
@Autowired
public ServerCommandLineRunner(SocketIOServer server) {
this.server = server;
server.addConnectListener(new ConnectListener() {
public void onConnect(SocketIOClient client) {
System.out.println("Client connected: " + client.getSessionId());
}
});
server.addDisconnectListener(new DisconnectListener() {
public void onDisconnect(SocketIOClient client) {
System.out.println("Client disconnected: " + client.getSessionId());
}
});
server.addEventListener("chat", String.class, (client, data, ackRequest) -> {
System.out.println("Message received: " + data);
server.getBroadcastOperations().sendEvent("chat", data);
});
}
@Override
public void run(String... args) throws Exception {
server.start();
}
}
Hi @ptejada, awesome work on upgrading the Socket.io engine. Would you be interested in merging the changes into Artillery itself?
Hello! I'm trying to connect a virtual user (VU) to my socket.io server that joins a room, waits for a message to be sent from the server to that room, and triggers a custom function on receiving that event.
The server has an external trigger that emits an event (fooEvent
), and I want to inject a custom hook for some metric collection.
For example, I'd hope to do something like this:
scenarios:
- name: new socket.io client listening for event
flow:
- emit: ["join", "room1"]
response:
on: fooEvent
function: myCustomFunction
A version of this question has already been asked here, but I believe my use case it subtly different.
All the examples that use response
here seem to be dependent on an emit
first, and none of them use functions in ./functions.js
in the way that I'm trying to use it.
Hello, thanks for your work on this package!
I installed artillery following the main docs, and the v3 engine using the readme.
My yaml file:
config:
target: "http://localhost:3000"
phases:
- duration: 30
arrivalRate: 5
engines:
socketio-v3: {}
scenarios:
- name: test
engine: socketio-v3
flow:
- emit: ["test"]
When I run the test, I get the following error:
/Users/me/.nvm/versions/node/v16.4.0/lib/node_modules/artillery/lib/commands/run.js:318
script.scenarios.forEach(function(scenario) {
^
TypeError: Cannot read property 'forEach' of undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.