Update websocket.js

This commit is contained in:
Namhyeon Go 2021-06-20 06:47:04 +09:00 committed by GitHub
parent e535963013
commit b3907bd2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@
var SHELL = require("lib/shell");
var SYS = require("lib/system");
var FILE = require("lib/file");
var WebsocketObject = function() {
this.binPath = "bin\\websocat_nossl_win64";
@ -44,11 +45,21 @@ var WebsocketObject = function() {
};
this.send = function(uri, msg) {
return SHELL.exec([
this.binPath,
"-t",
uri
]);
var FN = "stdin.txt";
try {
FILE.writeFile(FN, msg);
return SHELL.exec([
this.binPath,
"-t",
uri,
"<",
FN
]);
} catch (e) {
console.error("WebsocketObject.send() -> " + e.message);
}
};
this.create = function() {