<commit_before>package main

import (
	"net/http"

	"github.com/byuoitav/event-router-microservice/eventinfrastructure"
	"github.com/byuoitav/touchpanel-ui-microservice/events"
	"github.com/byuoitav/touchpanel-ui-microservice/handlers"
	"github.com/jessemillar/health"
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
)

func main() {
	pub := eventinfrastructure.NewPublisher("7003")
	sub := eventinfrastructure.NewSubscriber()

	filters := []string{eventinfrastructure.UI}
	ip := eventinfrastructure.GetIP()
	pubAddr := ip + ":7003"

	var req eventinfrastructure.ConnectionRequest
	req.PublisherAddr = pubAddr
	req.SubscriberEndpoint = ip + ":8888"

	// post to the router with the subscription request
	eventinfrastructure.SendConnectionRequest("http://localhost:6999/subscribe", req)

	go events.WriteMessagesToSocket(sub)

	port := ":8888"
	router := echo.New()
	router.Pre(middleware.RemoveTrailingSlash())
	router.Use(middleware.CORS())

	router.GET("/health", echo.WrapHandler(http.HandlerFunc(health.Check)))

	// event endpoints
	router.POST("/subscribe", eventinfrastructure.Subscribe, eventinfrastructure.BindSubscriber(sub), eventinfrastructure.BindFiltersAndPublisherAddress(filters, pubAddr))
	router.POST("/publish", handlers.PublishEvent, eventinfrastructure.BindPublisher(pub))
	router.POST("/publishfeature", handlers.PublishFeature, eventinfrastructure.BindPublisher(pub))

	router.GET("/websocket", handlers.OpenWebSocket)
	router.GET("/hostname", handlers.GetHostname)
	router.GET("/deviceinfo", handlers.GetDeviceInfo)
	router.GET("/reboot", handlers.Reboot)
	router.GET("/dockerstatus", handlers.GetDockerStatus)
	router.GET("/json", handlers.GetJSON)

	router.POST("/help", handlers.Help)
	router.POST("/confirmhelp", handlers.ConfirmHelp)
	router.POST("/cancelhelp", handlers.CancelHelp)

	router.Static("/", "redirect.html")
	router.Static("/circle-default", "circle-default")
<commit_msg>hard to test with no connection<commit_after>package main

import (
	"net/http"

	"github.com/byuoitav/event-router-microservice/eventinfrastructure"
	"github.com/byuoitav/touchpanel-ui-microservice/events"
	"github.com/byuoitav/touchpanel-ui-microservice/handlers"
	"github.com/jessemillar/health"
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
)

func main() {
	pub := eventinfrastructure.NewPublisher("7003")

	filters := []string{eventinfrastructure.UI}
	sub := eventinfrastructure.NewSubscriber(filters)

	ip := eventinfrastructure.GetIP()
	pubAddr := ip + ":7003"

	var req eventinfrastructure.ConnectionRequest
	req.PublisherAddr = pubAddr
	//	req.SubscriberEndpoint = "http://" + ip + ":8888"
	req.SubscriberEndpoint = "http://localhost:8888/subscribe"

	// post to the router with the subscription request
	go eventinfrastructure.SendConnectionRequest("http://localhost:6999/subscribe", req)

	go events.WriteMessagesToSocket(sub)

	port := ":8888"
	router := echo.New()
	router.Pre(middleware.RemoveTrailingSlash())
	router.Use(middleware.CORS())

	router.GET("/health", echo.WrapHandler(http.HandlerFunc(health.Check)))

	// event endpoints
	router.POST("/subscribe", sub.HandleSubscriptionRequest)
	router.POST("/publish", handlers.PublishEvent, eventinfrastructure.BindPublisher(pub))
	router.POST("/publishfeature", handlers.PublishFeature, eventinfrastructure.BindPublisher(pub))

	router.GET("/websocket", handlers.OpenWebSocket)
	router.GET("/hostname", handlers.GetHostname)
	router.GET("/deviceinfo", handlers.GetDeviceInfo)
	router.GET("/reboot", handlers.Reboot)
	router.GET("/dockerstatus", handlers.GetDockerStatus)
	router.GET("/json", handlers.GetJSON)

	router.POST("/help", handlers.Help)
	router.POST("/confirmhelp", handlers.ConfirmHelp)
	router.POST("/cancelhelp", handlers.CancelHelp)

	router.Static("/", "redirect.html")
	router.Static("/circle-default", "circle-default")

{'fraction_non_alphanumeric': 0.14615185281160922, 'fraction_numerical': 0.011401917595231926, 'mean_word_length': 6.3106060606060606, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4058464', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1184, 'n_words': 178}