Skip to content

Commit

Permalink
[US] Modified the messages sent to the CSMS via the websocket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
usuletw022 committed Sep 22, 2023
1 parent b1e532e commit 32e170d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions loadtests/ws_load_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ws from 'k6/ws';
import { check } from 'k6';
export const options = {
duration: '10s',
vus: 1
};

Expand All @@ -13,18 +12,18 @@ export default function () {


const res = ws.connect(url, params, function (socket) {
socket.on('open', () => console.log('connected'));
socket.on('message', () => console.log('Message received: ', '[2,"9","BootNotification",{"chargePointModel":"me100","chargePointVendor":"me"}]'));
socket.on('message', () => console.log('Message received: ', '[2, "10", "StatusNotification", {"connectorId": 1, "errorCode": "NoError", "status": "Available"}]'));
socket.on('message', () => console.log('Message received: ', '[2,"11","Heartbeat", {}]'));
socket.on('message', () => console.log('Message received: ', '[2,"12","Heartbeat", {}]'));
socket.on('message', () => console.log('Message received: ', '[2,"13","Heartbeat", {}]'));
socket.on('message', () => console.log('Message received: ', '[2, "14", "[2, "16", "Authorize", {"idTag": "38748383L7337848H823"}]'));
socket.on('message', () => console.log('Message received: ', '[2, "15", "StartTransaction",{"connectorId": 1, "idTag": "38748383L7337848H823", "meterStart": 3, "reservationId": 5, "timestamp":"2023-09-18T08:25:40.20Z"}]'));
socket.on('message', () => console.log('Message received: ', '[2, "16", "MeterValues", {"connectorId": 1, "meterValue":[{"timestamp":"2023-09-18T08:25:40.20Z", "sampledValue": [{"value": "5"}]}]}]'));
socket.on('message', () => console.log('Message received: ', '[2, "17", "MeterValues", {"connectorId": 1, "meterValue":[{"timestamp":"2023-09-18T08:25:40.20Z", "sampledValue": [{"value": "5"}]}]}]'));
socket.on('message', () => console.log('Message received: ', '[2, "18", "StopTransaction", {"idTag": "38748383L7337848H823", "meterStop": 3, "timestamp": "2023-09-18T08:25:40.20Z", "transactionId": 3}]'));
socket.on('close', () => console.log('disconnected'));
socket.send('[2,"9","BootNotification",{"chargePointModel":"me100","chargePointVendor":"me"}]');
socket.send('[2,"9","BootNotification",{"chargePointModel":"me100","chargePointVendor":"me"}]');
socket.send('[2, "10", "StatusNotification", {"connectorId": 1, "errorCode": "NoError", "status": "Available"}]');
socket.send('[2,"11","Heartbeat", {}]');
socket.send('[2,"12","Heartbeat", {}]');
socket.send('[2,"13","Heartbeat", {}]');
socket.send('[2, "14", "[2, "16", "Authorize", {"idTag": "38748383L7337848H823"}]');
socket.send('[2, "15", "StartTransaction",{"connectorId": 1, "idTag": "38748383L7337848H823", "meterStart": 3, "reservationId": 5, "timestamp":"2023-09-18T08:25:40.20Z"}]');
socket.send('[2, "16", "MeterValues", {"connectorId": 1, "meterValue":[{"timestamp":"2023-09-18T08:25:40.20Z", "sampledValue": [{"value": "5"}]}]}]');
socket.send('[2, "17", "MeterValues", {"connectorId": 1, "meterValue":[{"timestamp":"2023-09-18T08:25:40.20Z", "sampledValue": [{"value": "5"}]}]}]');
socket.send('[2, "18", "StopTransaction", {"idTag": "38748383L7337848H823", "meterStop": 3, "timestamp": "2023-09-18T08:25:40.20Z", "transactionId": 3}]');
socket.close()
});

check(res, { 'status is 101': (r) => r && r.status === 101 });
Expand Down

0 comments on commit 32e170d

Please sign in to comment.