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.status = 'stop';
this.icon.bind('click', this.toggle_button.bind(this)); this.icon.bind('click', this.toggle_button.bind(this));
this.add_widget(this.icon); 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.socket.onmessage = this.response_data.bind(this);
this.bind('transtext', this.response_log.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.volume = 1.0;
this.initAudioContext(); this.initAudioContext();
this.initWebSocket();
} }
initAudioContext() { initAudioContext() {

View File

@ -45,7 +45,8 @@ bricks.Signaling = class {
} }
init_websocket(){ 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.onmessage = this.signaling_recvdata.bind(this);
this.socket.onopen = this.login.bind(this); this.socket.onopen = this.login.bind(this);
this.socket.onclose = this.reconnect.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(); var session = bricks.app.get_session();
this.ws = new WebSocket(this.ws_url, sessopn); this.ws = new WebSocket(this.ws_url, sessopn);
} else { } else {
this.ws = new WebSocket(this.ws_url, sessopn); this.ws = new WebSocket(this.ws_url);
} }
this.ws.onopen = function(){ this.ws.onopen = function(){
this.dispatch('onopen'); this.dispatch('onopen');
@ -61,6 +61,13 @@ bricks.WebSocket = class extends bricks.VBox {
} }
this.send(d); this.send(d);
} }
send_typedata(type, data){
var d = {
type:type,
data:data
}
return send(d);
}
send(d){ send(d){
/* d is a object: /* d is a object:
{ {

View File

@ -30,7 +30,8 @@ bricks.Wterm = class extends bricks.JsWidget {
var term = new Terminal(term_options); var term = new Terminal(term_options);
this.term = term; this.term = term;
term.open(this.dom_element); 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.socket = ws;
this.fitAddon = new FitAddon.FitAddon() this.fitAddon = new FitAddon.FitAddon()