Skip to content

Fix: websocket url parser#326

Open
fdelpoggio wants to merge 2 commits into
abstracta:masterfrom
fdelpoggio:fix/websocket-url-parser
Open

Fix: websocket url parser#326
fdelpoggio wants to merge 2 commits into
abstracta:masterfrom
fdelpoggio:fix/websocket-url-parser

Conversation

@fdelpoggio

Copy link
Copy Markdown
Contributor

Fix the WebSocket URL parser and add text/binary data type to WebSocket read and write sampler

@fdelpoggio fdelpoggio changed the title Fix/websocket url parser Fix: websocket url parser Jun 18, 2026
*/
public static DslWriteSampler websocketWrite(String requestData) {
return new DslWriteSampler(requestData);
public static DslWriteSampler websocketWrite(String requestData, String dataType) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider use an Enum for type, in caso it field could be a JMeter variable maybe you should expose both methods

public static DslWriteSampler websocketWrite(String requestData, String dataType)

and

public static DslWriteSampler websocketWrite(String requestData, DataType dataType)

*/
public static DslReadSampler websocketRead() {
return new DslReadSampler();
public static DslReadSampler websocketRead(String type) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before

*/
public static DslWriteSampler websocketWrite(String requestData) {
return new DslWriteSampler(requestData);
public static DslWriteSampler websocketWrite(String requestData, String dataType) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a default method without dataType param using text as default

private String dataType;

private DslWriteSampler(String requestData) {
private DslWriteSampler(String requestData, String dataType) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment regarding to data type

String scheme = uri.getScheme();
if (scheme == null || (!"ws".equals(scheme) && !"wss".equals(scheme))) {
private void parseUrl(String url) {
JmeterUrl parsed = JmeterUrl.valueOf(url);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if url string is full variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants