caddy: Index | Files

package websocket

import ""

Package websocket implements a WebSocket server by executing a command and piping its input and output through the WebSocket connection.


Package Files

setup.go websocket.go


var (
    // GatewayInterface is the dialect of CGI being used by the server
    // to communicate with the script.  See CGI spec, 4.1.4
    GatewayInterface string

    // ServerSoftware is the name and version of the information server
    // software making the CGI request.  See CGI spec, 4.1.17
    ServerSoftware string

type Config Uses

type Config struct {
    Path      string
    Command   string
    Arguments []string
    Respawn   bool // TODO: Not used, but parser supports it until we decide on it
    Type      string
    BufSize   int

Config holds the configuration for a single websocket endpoint which may serve multiple websocket connections.

type WebSocket Uses

type WebSocket struct {
    // Next is the next HTTP handler in the chain for when the path doesn't match
    Next httpserver.Handler

    // Sockets holds all the web socket endpoint configurations
    Sockets []Config

WebSocket is a type that holds configuration for the websocket middleware generally, like a list of all the websocket endpoints.

func (WebSocket) ServeHTTP Uses

func (ws WebSocket) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP converts the HTTP request to a WebSocket connection and serves it up.

Package websocket imports 15 packages (graph) and is imported by 108 packages. Updated 2019-07-25. Refresh now. Tools for package owners.