2023-09-17 16:29:46 -07:00
|
|
|
package main
|
|
|
|
|
|
2023-09-20 22:09:15 -07:00
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"connectrpc.com/grpcreflect"
|
|
|
|
|
servicepb "github.com/chathaway-codes/home-sensors/v2/gen/genconnect"
|
|
|
|
|
"github.com/chathaway-codes/home-sensors/v2/pkg/signaler"
|
|
|
|
|
)
|
2023-09-17 16:29:46 -07:00
|
|
|
|
|
|
|
|
func main() {
|
2023-09-20 22:09:15 -07:00
|
|
|
mux := http.NewServeMux()
|
|
|
|
|
reflector := grpcreflect.NewStaticReflector(
|
|
|
|
|
servicepb.SignalerServiceName,
|
|
|
|
|
)
|
|
|
|
|
path, _ := grpcreflect.NewHandlerV1(reflector)
|
|
|
|
|
fmt.Printf("Got path %s\n", path)
|
|
|
|
|
mux.Handle(grpcreflect.NewHandlerV1(reflector))
|
|
|
|
|
path, _ = grpcreflect.NewHandlerV1Alpha(reflector)
|
|
|
|
|
fmt.Printf("Got path %s\n", path)
|
|
|
|
|
mux.Handle(grpcreflect.NewHandlerV1Alpha(reflector))
|
|
|
|
|
|
|
|
|
|
path, _ = servicepb.NewSignalerServiceHandler(signaler.New())
|
|
|
|
|
fmt.Printf("Got path %s\n", path)
|
|
|
|
|
mux.Handle(servicepb.NewSignalerServiceHandler(signaler.New()))
|
|
|
|
|
|
|
|
|
|
if err := http.ListenAndServe("127.0.0.1:8080", mux); err != nil {
|
|
|
|
|
log.Fatalf("Failed to listen for HTTP traffic: %v", err)
|
|
|
|
|
}
|
2023-09-17 16:29:46 -07:00
|
|
|
}
|