@@ -817,6 +817,9 @@ async def publish_loop(self):
817817 await self .send (* msg )
818818
819819 async def start (self , address , port , verbose = True , call_on_start = None ):
820+ await self .start_multi_address ([(address , port )], call_on_start = call_on_start )
821+
822+ async def start_multi_address (self , addresses , call_on_start = None ):
820823 runner = web .AppRunner (self .app , access_log = None )
821824 await runner .setup ()
822825 ssl_ctx = None
@@ -827,17 +830,26 @@ async def start(self, address, port, verbose=True, call_on_start=None):
827830 keyfile = args .tls_keyfile )
828831 scheme = "https"
829832
830- site = web .TCPSite (runner , address , port , ssl_context = ssl_ctx )
831- await site .start ()
833+ logging .info ("Starting server\n " )
834+ for addr in addresses :
835+ address = addr [0 ]
836+ port = addr [1 ]
837+ site = web .TCPSite (runner , address , port , ssl_context = ssl_ctx )
838+ await site .start ()
839+
840+ if not hasattr (self , 'address' ):
841+ self .address = address #TODO: remove this
842+ self .port = port
843+
844+ if ':' in address :
845+ address_print = "[{}]" .format (address )
846+ else :
847+ address_print = address
832848
833- self .address = address
834- self .port = port
849+ logging .info ("To see the GUI go to: {}://{}:{}" .format (scheme , address_print , port ))
835850
836- if verbose :
837- logging .info ("Starting server\n " )
838- logging .info ("To see the GUI go to: {}://{}:{}" .format (scheme , address , port ))
839851 if call_on_start is not None :
840- call_on_start (scheme , address , port )
852+ call_on_start (scheme , self . address , self . port )
841853
842854 def add_on_prompt_handler (self , handler ):
843855 self .on_prompt_handlers .append (handler )
0 commit comments