Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const options = {
- ca: fs.readFileSync("./ca.crt"),
- };
- var client = new WebSocketClient();
- client.on("connectFailed", function (error) {
- console.log("Connect Error: " + error.toString());
- });
- client.on("connect", function (connection) {
- console.log("WebSocket Client Connected");
- connection.on("error", function (error) {
- console.log("Connection Error: " + error.toString());
- });
- connection.on("close", function () {
- console.log("echo-protocol Connection Closed");
- });
- connection.on("message", function (message) {
- if (message.type === "utf8") {
- console.log("Received: '" + message.utf8Data + "'");
- }
- });
- });
- client.connect("wss://192.168.230.138:8080/", null, null, null, options);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement