lrserver alternatives and similar packages
Based on the "Utilities" category.
Alternatively, view lrserver alternatives based on common mentions on social networks and blogs.
-
xlsx
Library to simplify reading the XML format used by recent version of Microsoft Excel in Go programs. -
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report. -
go-funk
A modern Go utility library which provides helpers (map, find, contains, filter, chunk, reverse, ...) -
mc
Minio Client provides minimal tools to work with Amazon S3 compatible cloud storage and filesystems. -
mergo
A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. -
beaver
Beaver is a real-time messaging server. With beaver you can easily build scalable in-app notifications, realtime graphs, multiplayer games, chat applications, geotracking and more in web applications and mobile apps. -
httpcontrol
Package httpcontrol allows for HTTP transport level control around timeouts and retries.
Get performance insights in less than 4 minutes
Do you think we are missing an alternative of lrserver or a related project?
README
lrserver
LiveReload server for Go
Golang package that implements a simple LiveReload server as described in the LiveReload protocol.
Using the recommended default port 35729:
http://localhost:35729/livereload.js
serves the LiveReload client JavaScript (https://github.com/livereload/livereload-js)ws://localhost:35729/livereload
communicates with the client via web socket.
File watching must be implemented by your own application, and reload/alert requests sent programmatically.
Multiple servers can be instantiated, and each can support multiple connections.
Full Documentation: 
Basic Usage
Get Package
go get github.com/jaschaephraim/lrserver
Import Package
import "github.com/jaschaephraim/lrserver"
Instantiate Server
lr := lrserver.New(lrserver.DefaultName, lrserver.DefaultPort)
Start Server
go func() {
err := lr.ListenAndServe()
if err != nil {
// Handle error
}
}()
Send Messages to the Browser
lr.Reload("file")
lr.Alert("message")
Example
import (
"log"
"net/http"
"github.com/jaschaephraim/lrserver"
"gopkg.in/fsnotify.v1"
)
// html includes the client JavaScript
const html = `<!doctype html>
<html>
<head>
<title>Example</title>
</head>
<body>
<script src="http://localhost:35729/livereload.js"></script>
</body>
</html>`
func Example() {
// Create file watcher
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatalln(err)
}
defer watcher.Close()
// Add dir to watcher
err = watcher.Add("/path/to/watched/dir")
if err != nil {
log.Fatalln(err)
}
// Create and start LiveReload server
lr := lrserver.New(lrserver.DefaultName, lrserver.DefaultPort)
go lr.ListenAndServe()
// Start goroutine that requests reload upon watcher event
go func() {
for {
select {
case event := <-watcher.Events:
lr.Reload(event.Name)
case err := <-watcher.Errors:
log.Println(err)
}
}
}()
// Start serving html
http.HandleFunc("/", func(rw http.ResponseWriter, req *http.Request) {
rw.Write([]byte(html))
})
http.ListenAndServe(":3000", nil)
}