Documentation
¶
Index ¶
Constants ¶
View Source
const ( // The default port of the server DefaultPort uint = 8080 // The default route from where the js script that handles page reloads will be served from DefaultClientScriptRoute = "/hot-reload.js" // The default route from where the websocket that sends reload signals to the client will be listening from DefaultWebsocketRoute = "/hot-reload-websocket" // The default interval between ping messages sent by the server to the client DefaultPingIntervalMs = 10_000 )
Variables ¶
This section is empty.
Functions ¶
func DefaultDirectory ¶
Returns the default directory that contains the files that will be watched for changes and served by the server
Types ¶
type Config ¶
type Config struct {
// The default port of the server
Port uint `json:"port"`
// The directory that contains the files that will be watched for changes and served by the server
Directory string `json:"directory"`
// The route from where the js script that handles page reloads will be served from
ClientScriptRoute string `json:"clientScriptRoute"`
// The route from where the websocket that sends reload signals to the client will be listening from
WebSocketRoute string `json:"websocketRoute"`
// The interval between ping messages sent by the server to the client
PingIntervalMs uint `json:"pingIntervalMs"`
}
Configuration for the server
func (*Config) FillInDefaults ¶
func (self *Config) FillInDefaults()
Sets the uninitialized fields of this config to their default values
func (Config) GenerateClientScript ¶
Generate a js script that will connect to the server launched with this config
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A server is responsible for watching and serving the files inside a directry and notifying the client for changes to such files
type WebsocketServer ¶
func NewWebsocketServer ¶
func (*WebsocketServer) ServeHTTP ¶
func (self *WebsocketServer) ServeHTTP(response http.ResponseWriter, request *http.Request)
Click to show internal directories.
Click to hide internal directories.