func (s *Server) Port() uint16 {
	return s.port
}
Port gets the port that the server is listening on
package lrserver
import (
	"fmt"
	"log"
	"net"
	"net/http"
	"os"
	"strconv"
	"context"
	"github.com/gorilla/websocket"
)
type Server struct {
	name      string
	port      uint16
	server    *http.Server
	connSet   *connSet
	js        string
	statusLog *log.Logger
	liveCSS   bool
}
func New(name string, port uint16) *Server {
	router := http.NewServeMux()
	logPrefix := "[" + name + "] "
	s := &Server{
		name: name,
		server: &http.Server{
			Handler:  router,
			ErrorLog: log.New(os.Stderr, logPrefix, 0),
		},
		connSet:   &connSet{conns: make(map[*conn]struct{})},
		statusLog: log.New(os.Stdout, logPrefix, 0),
		liveCSS:   true,
	}
	s.setPort(port)
	router.HandleFunc("/livereload.js", jsHandler(s))
	router.HandleFunc("/livereload", webSocketHandler(s))
	return s
}
func (s *Server) Close() error {
	if s.server != nil {
		return s.server.Close()
	}
	return nil
}
func (s *Server) Shutdown(ctx context.Context) error {
	if s.server != nil {
		return s.server.Shutdown(ctx)
	}
	return nil
}
func (s *Server) ListenAndServe() error {
	l, err := net.Listen("tcp", makeAddr(s.port))
	if err != nil {
		return err
	}
	if s.port == 0 {
		port, err := makePort(l.Addr().String())
		if err != nil {
			return err
		}
		s.setPort(port)
	}
	s.logStatus("listening on " + s.server.Addr)
	return s.server.Serve(l)
}
func (s *Server) Reload(file string) {
	s.logStatus("requesting reload: " + file)
	for conn := range s.connSet.conns {
		conn.reloadChan <- file
	}
}
func (s *Server) Alert(msg string) {
	s.logStatus("requesting alert: " + msg)
	for conn := range s.connSet.conns {
		conn.alertChan <- msg
	}
}
func (s *Server) Name() string {
	return s.name
}