server

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const FreshUrl = "/ws-go-live-server"
View Source
const InjectScript = `` /* 544-byte string literal not displayed */

Variables

This section is empty.

Functions

func PortIsUsed

func PortIsUsed(port int) bool

PortIsUsed 检查端口是否被占用

func StartWatcher

func StartWatcher(name string, callback func(op fsnotify.Event)) error

StartWatcher 监听目录变动

Types

type StaticServer added in v1.0.2

type StaticServer struct {
	Base  string
	Index string
	Port  int
	Live  bool
	// contains filtered or unexported fields
}

func (*StaticServer) Render404 added in v1.0.2

func (s *StaticServer) Render404(w http.ResponseWriter)

func (*StaticServer) Render500 added in v1.0.2

func (s *StaticServer) Render500(w http.ResponseWriter, err error)

func (*StaticServer) RenderDir added in v1.0.2

func (s *StaticServer) RenderDir(w http.ResponseWriter, dirPath string)

func (*StaticServer) RenderFile added in v1.0.2

func (s *StaticServer) RenderFile(w http.ResponseWriter, r *http.Request, filePath string)

func (*StaticServer) RenderHtml added in v1.0.2

func (s *StaticServer) RenderHtml(w http.ResponseWriter, filePath string)

func (*StaticServer) Run added in v1.0.2

func (s *StaticServer) Run() error

type WSManager added in v1.0.2

type WSManager struct {
	// contains filtered or unexported fields
}

WSManager 保存所有websocket链接

func (*WSManager) Add added in v1.0.2

func (wm *WSManager) Add(ws *websocket.Conn)

func (*WSManager) Broadcast added in v1.0.2

func (wm *WSManager) Broadcast(data interface{})

func (*WSManager) Remove added in v1.0.2

func (wm *WSManager) Remove(ws *websocket.Conn, lock bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL