我想做与Katalon这篇文章中描述的类似的事情。 http://stackoverflow.com/questions/32016487/how-to-connect-to-a-websocket-from-a-different-server
尤其是这样的东西:
var ws = new WebSocket('wss://ServerA:8080/', 'echo-protocol');
ws.onopen = function () {
console.log('socket connection opened properly');
ws.send("Hello World"); // send a message
console.log('message sent');
};
ws.onmessage = function (evt) {
console.log("Message received = " + evt.data);
};
ws.onclose = function () {
// websocket is closed.
console.log("Connection closed...");
};