mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 11:32:56 +00:00 
			
		
		
		
	Use reverse proxyed terminado websocket
This commit is contained in:
		@@ -12,7 +12,8 @@ export class TerminadoService {
 | 
				
			|||||||
    Terminal.applyAddon(fit);
 | 
					    Terminal.applyAddon(fit);
 | 
				
			||||||
    Terminal.applyAddon(terminado);
 | 
					    Terminal.applyAddon(terminado);
 | 
				
			||||||
    this.xterm = new Terminal();
 | 
					    this.xterm = new Terminal();
 | 
				
			||||||
    this.ws = new WebSocket('ws://localhost:7878/terminal');
 | 
					    let wsproto = (location.protocol === 'https:') ? 'wss://' : 'ws://';
 | 
				
			||||||
 | 
					    this.ws = new WebSocket(wsproto + window.location.host + '/terminal');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  attach(element: HTMLElement) {
 | 
					  attach(element: HTMLElement) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,8 +30,9 @@ export class WebSocketService {
 | 
				
			|||||||
    // Using share() causes a single WebSocket to be created when the first
 | 
					    // Using share() causes a single WebSocket to be created when the first
 | 
				
			||||||
    // observer subscribes. This socket is shared with subsequent observers
 | 
					    // observer subscribes. This socket is shared with subsequent observers
 | 
				
			||||||
    // and closed when the observer count falls to zero.
 | 
					    // and closed when the observer count falls to zero.
 | 
				
			||||||
 | 
					    let wsproto = (location.protocol === 'https:') ? 'wss://' : 'ws://';
 | 
				
			||||||
    this.downlink = jsonWebsocketConnect(
 | 
					    this.downlink = jsonWebsocketConnect(
 | 
				
			||||||
      'ws://' + window.location.host + '/ws',
 | 
					      wsproto + window.location.host + '/ws',
 | 
				
			||||||
      this.uplink = new QueueingSubject<object>()
 | 
					      this.uplink = new QueueingSubject<object>()
 | 
				
			||||||
    ).messages.pipe(
 | 
					    ).messages.pipe(
 | 
				
			||||||
        map(message => <WSMessage<undefined>> message),
 | 
					        map(message => <WSMessage<undefined>> message),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user