mirror of
https://github.com/huashengdun/webssh.git
synced 2026-08-23 06:06:29 +00:00
Fixed a bug that client closes websocket on handling non utf-8 encoded bytes
This commit is contained in:
@@ -91,8 +91,14 @@ jQuery(function($){
|
||||
};
|
||||
|
||||
socket.onmessage = function(msg) {
|
||||
// console.log(msg);
|
||||
term.write(msg.data);
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function(event){
|
||||
var decoder = new TextDecoder();
|
||||
var text = decoder.decode(reader.result);
|
||||
// console.log(text);
|
||||
term.write(text);
|
||||
};
|
||||
reader.readAsArrayBuffer(msg.data);
|
||||
};
|
||||
|
||||
socket.onerror = function(e) {
|
||||
|
||||
Reference in New Issue
Block a user