@@ -22,7 +22,6 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
2222 @Input ( ) origin : string ;
2323 @ViewChild ( 'iFrame' , { static : false } ) iframeRef : ElementRef ;
2424 @Output ( ) onLoad : EventEmitter < Boolean > = new EventEmitter < Boolean > ( ) ;
25- @Output ( ) socketCloseEvent : EventEmitter < Boolean > = new EventEmitter < Boolean > ( ) ;
2625 @Output ( ) createFileConnectToken : EventEmitter < Boolean > = new EventEmitter < Boolean > ( ) ;
2726 eventHandler : EventListenerOrEventListenerObject ;
2827 private renewalTrigger = new Subject < void > ( ) ;
@@ -47,6 +46,7 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
4746 private iframeCommunicationService : IframeCommunicationService
4847 ) {
4948 }
49+
5050 ngOnInit ( ) {
5151 this . _logger . info ( `IFrame URL: ${ this . src } ` ) ;
5252
@@ -68,7 +68,9 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
6868 this . eventHandler = function ( e : any ) {
6969 const msg = e . data ;
7070
71- if ( msg . id !== this . id ) { return ; }
71+ if ( msg . id !== this . id ) {
72+ return ;
73+ }
7274
7375 switch ( msg . name ) {
7476 case 'PING' : {
@@ -88,11 +90,10 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
8890 if ( this . view && this . view . connected ) {
8991 this . view . connected = false ;
9092 }
91- this . socketCloseEvent . emit ( true ) ;
9293 if ( this . view && this . view . connectToken && this . view . connectToken . face_monitor_token ) {
9394 this . faceService . removeMonitoringTab ( this . view . id ) ;
9495 }
95- this . iframeCommunicationService . sendMessage ( { name : 'CLOSE' } )
96+ this . iframeCommunicationService . sendMessage ( { name : 'CLOSE' } ) ;
9697 break ;
9798 case 'CONNECTED' :
9899 this . view . connected = true ;
@@ -144,7 +145,7 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
144145 // @ts -ignore
145146 this . ping = setInterval ( ( ) => {
146147 this . _logger . info ( `[Luna] Send PING to: ${ this . id } ` ) ;
147- this . iframeWindow . postMessage ( { name : 'PING' , id : this . id } , '*' ) ;
148+ this . iframeWindow . postMessage ( { name : 'PING' , id : this . id , protocol : this . view . protocol } , '*' ) ;
148149 } , 500 ) ;
149150
150151 this . subscription = this . iframeCommunicationService . message$ . subscribe ( ( message ) => {
@@ -169,7 +170,7 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
169170 if ( event . data && typeof event . data === 'object' ) {
170171 this . termComp = event . data ;
171172 }
172- }
173+ } ;
173174
174175 async reconnect ( ) {
175176 const oldConnectToken = this . view . connectToken ;
@@ -180,10 +181,10 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
180181 }
181182
182183 // 更新当前 view 的 connectToken
183- this . src = 'about:blank' ;
184184 this . view . connectToken = newConnectToken ;
185185
186186 const url = this . src . replace ( oldConnectToken . id , newConnectToken . id ) ;
187+ this . src = 'about:blank' ;
187188
188189 setTimeout ( ( ) => {
189190 this . src = url ;
0 commit comments