refactor(webclient): remove serverWorker goroutine and function

Removes the serverWorker goroutine invocation and the entire serverWorker function from main_js.go, which was responsible for starting an HTTP server in the WASM client environment. This simplifies the main function by eliminating unused server functionality.

lemon-mint committed Nov 1, 2025 at 02:52 UTC eaaed5e88507b7f6bb74de8e9f60b6bf3d1c4740
1 file changed -33
cmd/webclient/main_js.go
-33
@@ -532,8 +532,6 @@ func main() {
532 }))
533 log.Info().Msg("Portal proxy handler registered as __go_jshttp")
534
535 - go serverWorker(rdClient)
536 -
535 if runtime.Compiler == "tinygo" {
536 return
537 }
@@ -541,34 +539,3 @@ func main() {
539 ch := make(chan bool)
540 <-ch
541 }
544 -
545 -func serverWorker(client *sdk.RDClient) {
546 - time.Sleep(time.Second)
547 -
548 - cred := sdk.NewCredential()
549 - ln, err := client.Listen(cred, "WASM-Client-WebServer-"+cred.ID()[:8], []string{"http/1.1"})
550 - if err != nil {
551 - log.Error().Err(err).Msg("Failed to start listener")
552 - return
553 - }
554 - defer ln.Close()
555 -
556 - mux := http.NewServeMux()
557 - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
558 - w.WriteHeader(http.StatusOK)
559 - w.Write([]byte(`<!DOCTYPE html>
560 -<html>
561 -<head>
562 - <title>WASM Client Server</title>
563 -</head>
564 -<body>
565 - <h1>Hello, World! This server is running in a WASM client</h1>
566 - <p>Server ID: ` + cred.ID() + `</p>
567 -</body>
568 -</html>`))
569 - })
570 -
571 - if err := http.Serve(ln, mux); err != nil {
572 - log.Error().Err(err).Msg("Failed to start server")
573 - }
574 -}