{"modulePath":"github.com/wavetermdev/waveterm","version":"v0.14.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package web\n\n## Constants\n\n```go\nconst (\n\tCacheControlHeaderKey     = \"Cache-Control\"\n\tCacheControlHeaderNoCache = \"no-cache\"\n\n\tContentTypeHeaderKey = \"Content-Type\"\n\tContentTypeJson      = \"application/json\"\n\tContentTypeBinary    = \"application/octet-stream\"\n\n\tContentLengthHeaderKey = \"Content-Length\"\n\tLastModifiedHeaderKey  = \"Last-Modified\"\n\n\tWaveZoneFileInfoHeaderKey = \"X-ZoneFileInfo\"\n)\n```\nHeader constants\n\n```go\nconst DefaultCommandTimeout = 2 * time.Second\n```\n\n```go\nconst HttpMaxHeaderBytes = 60000\n```\n\n```go\nconst HttpReadTimeout = 5 * time.Second\n```\n\n```go\nconst HttpTimeoutDuration = 21 * time.Second\n```\n\n```go\nconst HttpWriteTimeout = 21 * time.Second\n```\n\n```go\nconst TransparentGif64 = \"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n```\n\n```go\nconst WSStatePacketChSize = 20\n```\n\n```go\nconst WSStateReconnectTime = 30 * time.Second\n```\n\n```go\nconst WebSocketChannelSize = 128\n```\n\n## Variables\n\n```go\nvar GlobalLock = \u0026sync.Mutex{}\n```\n\n```go\nvar RouteToConnMap = map[string]*StableConnInfo{} // stableid =\u003e StableConnInfo\n\n```\n\n```go\nvar WebSocketUpgrader = websocket.Upgrader{\n\tReadBufferSize:   4 * 1024,\n\tWriteBufferSize:  32 * 1024,\n\tHandshakeTimeout: 1 * time.Second,\n\tCheckOrigin:      func(r *http.Request) bool { return true },\n}\n```\n\n## Functions\n\n```go\nfunc HandleWs(w http.ResponseWriter, r *http.Request)\n```\n\n```go\nfunc HandleWsInternal(w http.ResponseWriter, r *http.Request) error\n```\n\n```go\nfunc MakeTCPListener(serviceName string) (net.Listener, error)\n```\n\n```go\nfunc MakeUnixListener() (net.Listener, error)\n```\n\n```go\nfunc ReadLoop(conn *websocket.Conn, outputCh chan any, closeCh chan any, rpcInputCh chan baseds.RpcInputChType, routeId string)\n```\n\n```go\nfunc RunWebServer(listener net.Listener)\n```\nblocking\n\n```go\nfunc RunWebSocketServer(listener net.Listener)\n```\n\n```go\nfunc WriteJsonError(w http.ResponseWriter, errVal error)\n```\n\n```go\nfunc WriteJsonSuccess(w http.ResponseWriter, data interface{})\n```\n\n```go\nfunc WriteLoop(conn *websocket.Conn, outputCh chan any, closeCh chan any, routeId string)\n```\n\n```go\nfunc WritePing(conn *websocket.Conn) error\n```\n\n## Types\n\n```go\ntype ClientActiveState struct {\n\tFg     bool `json:\"fg\"`\n\tActive bool `json:\"active\"`\n\tOpen   bool `json:\"open\"`\n}\n```\n\n```go\ntype StableConnInfo struct {\n\tConnId string\n\tLinkId baseds.LinkId\n}\n```\n\n```go\ntype WebFnOpts struct {\n\tAllowCaching bool\n\tJsonErrors   bool\n}\n```\n\n```go\ntype WebFnType = func(http.ResponseWriter, *http.Request)\n```\n\n```go\nfunc WebFnWrap(opts WebFnOpts, fn WebFnType) WebFnType\n```\n\n","path":"github.com/wavetermdev/waveterm/pkg/web","name":"web","synopsis":"","isRedistributable":true}
