// SPDX-FileCopyrightText: 2023 The Pion community // SPDX-License-Identifier: MIT package signal import ( "fmt" "io" "net/http" "strconv" ) // HTTPSDPServer starts a HTTP Server that consumes SDPs func HTTPSDPServer(port int) chan string { sdpChan := make(chan string) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { body, _ := io.ReadAll(r.Body) fmt.Fprintf(w, "done") sdpChan <- string(body) }) go func() { // nolint: gosec err := http.ListenAndServe(":"+strconv.Itoa(port), nil) if err != nil { panic(err) } }() return sdpChan }