@@ -9,6 +9,7 @@ class BridgeAdapter {
99 this . channels = [ ] ;
1010 this . users = [ ] ;
1111 this . currentChannel = { name : "/" , path : "/" } ;
12+ this . asyncMessages = [ ] ;
1213
1314 // Credentials from HTML config
1415 this . username = window . _ttUsername || "WebClient" ;
@@ -243,6 +244,15 @@ case "tt-user-list-full": // keep legacy support
243244 this . emit ( "channel-changed" ) ;
244245 break ;
245246
247+ case "cw-async" :
248+ // Store async message (optional but recommended)
249+ if ( ! this . asyncMessages ) this . asyncMessages = [ ] ;
250+ this . asyncMessages . push ( data ) ;
251+
252+ // Notify UI
253+ this . emit ( "async-message" , data ) ;
254+ break ;
255+
246256 default :
247257 this . emit ( "message" , data ) ;
248258 break ;
@@ -293,6 +303,9 @@ async getChannels() {
293303 return this . currentChannel ;
294304 }
295305
306+ async getAsyncMessages ( ) {
307+ return this . asyncMessages ;
308+ }
296309 joinChannel ( id ) {
297310 const ch = this . channels . find ( c => c . id === id ) ;
298311 const path = ch ? ch . path : "/" ;
@@ -310,7 +323,22 @@ async getChannels() {
310323 } ) ) ;
311324 }
312325
313- /* -------------------------------------------------------
326+ sendAsync ( text ) {
327+ this . ws . send ( JSON . stringify ( {
328+ type : "cw-async" ,
329+ text,
330+ timestamp : Date . now ( )
331+ } ) ) ;
332+ }
333+
334+ sendMessage ( text , mode = "live" ) {
335+ if ( mode === "async" ) {
336+ this . sendAsync ( text ) ;
337+ } else {
338+ this . sendChat ( text ) ;
339+ }
340+ }
341+ /* -------------------------------------------------------
314342 AAC UI wrappers
315343 ------------------------------------------------------- */
316344 async connectEverything ( ) {
0 commit comments