This commit is contained in:
yumoqing 2025-04-11 10:45:26 +08:00
parent 5eb2e6e35e
commit ed76cd0b6b
5 changed files with 14 additions and 5 deletions

View File

@ -27,7 +27,8 @@ bricks.ASRClient = class extends bricks.VBox {
this.status = 'stop';
this.icon.bind('click', this.toggle_button.bind(this));
this.add_widget(this.icon);
this.socket = new WebSocket(this.ws_url);
var sessdata = bricks.app.get_session();
this.socket = new WebSocket(this.ws_url, sessdata);
this.socket.onmessage = this.response_data.bind(this);
this.bind('transtext', this.response_log.bind(this));
}

View File

@ -13,7 +13,6 @@ bricks.ContinueAudioPlayer = class extends bricks.VBox {
this.volume = 1.0;
this.initAudioContext();
this.initWebSocket();
}
initAudioContext() {

View File

@ -45,7 +45,8 @@ bricks.Signaling = class {
}
init_websocket(){
this.socket = new WebSocket(this.signaling_url);
var sessdata = bricks.app.get_session();
this.socket = new WebSocket(this.signaling_url, sessdata);
this.socket.onmessage = this.signaling_recvdata.bind(this);
this.socket.onopen = this.login.bind(this);
this.socket.onclose = this.reconnect.bind(this);

View File

@ -20,7 +20,7 @@ bricks.WebSocket = class extends bricks.VBox {
var session = bricks.app.get_session();
this.ws = new WebSocket(this.ws_url, sessopn);
} else {
this.ws = new WebSocket(this.ws_url, sessopn);
this.ws = new WebSocket(this.ws_url);
}
this.ws.onopen = function(){
this.dispatch('onopen');
@ -61,6 +61,13 @@ bricks.WebSocket = class extends bricks.VBox {
}
this.send(d);
}
send_typedata(type, data){
var d = {
type:type,
data:data
}
return send(d);
}
send(d){
/* d is a object:
{

View File

@ -30,7 +30,8 @@ bricks.Wterm = class extends bricks.JsWidget {
var term = new Terminal(term_options);
this.term = term;
term.open(this.dom_element);
var ws = new WebSocket(this.opts.ws_url);
var sessdata = bricks.app.get_session();
var ws = new WebSocket(this.opts.ws_url, sessdata);
this.socket = ws;
this.fitAddon = new FitAddon.FitAddon()