Skip to content

Commit 9226aaa

Browse files
authored
feat(http): support for custom root
1 parent 6c6d42e commit 9226aaa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ async def root_endpoint():
298298
</script>
299299
</body>
300300
</html>
301-
""".replace('$WEBSOCKET_ENDPOINT', 'ws://%s:%d/ws' % (args.http_host, args.http_port))
301+
""".replace('$WEBSOCKET_ENDPOINT', 'ws://%s:%d%sws' % (args.http_host, args.http_port, args.http_root))
302302
return HTMLResponse(content=html_content, status_code=200)
303303
config = uvicorn.Config(app, args.http_host, args.http_port)
304304
self.server = uvicorn.Server(config)
@@ -395,6 +395,8 @@ def parse_args():
395395
help='HTTP server host')
396396
parser.add_argument('--http-port', type=int, default=8000,
397397
help='HTTP server port')
398+
parser.add_argument('--http-root', type=str, default='/',
399+
help='HTTP root')
398400
return parser.parse_args()
399401

400402
async def run():

0 commit comments

Comments
 (0)