From 97f893bd2d4a4efdc93fa1cf45aa4661450fe80d Mon Sep 17 00:00:00 2001 From: ulises-jeremias Date: Tue, 17 Oct 2023 18:43:27 -0300 Subject: [PATCH] Updated to use net.http instead of vweb --- plot/show.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plot/show.v b/plot/show.v index f044faaf5..62b636387 100644 --- a/plot/show.v +++ b/plot/show.v @@ -6,9 +6,6 @@ import net.http import os import time -// port is the port to run the server on. If 0, it will run on the next available port. -const port = 8080 - type TracesWithTypeValue = Trace | string struct PlotlyHandler { @@ -35,10 +32,11 @@ pub fn (plot Plot) show() ! { $if test ? { println('Ignoring plot.show() because we are running in test mode') } $else { + port := 8080 ch := chan int{} mut server := &http.Server{ accept_timeout: 1 * time.second - port: plot.port + port: port handler: PlotlyHandler{ plot: plot ch: ch @@ -48,7 +46,7 @@ pub fn (plot Plot) show() ! { for server.status() != .running { time.sleep(10 * time.millisecond) } - os.open_uri('http://localhost:${plot.port}')! + os.open_uri('http://localhost:${port}')! _ := <-ch server.close() t.wait()