juju: github.com/juju/juju/apiserver/websocket Index | Files | Directories

package websocket

import "github.com/juju/juju/apiserver/websocket"

Index

Package Files

websocket.go

Constants

const (
    // PongDelay is how long the server will wait for a pong to be sent
    // before the websocket is considered broken.
    PongDelay = 90 * time.Second

    // PingPeriod is how often ping messages are sent. This should be shorter
    // than the pongDelay, but not by too much. The difference here allows
    // the remote endpoint 30 seconds to respond to the ping as a ping is sent
    // every 60s, and when a pong is received the read deadline is advanced
    // another 90s.
    PingPeriod = 60 * time.Second

    // WriteWait is how long the write call can take before it errors out.
    WriteWait = 10 * time.Second
)

func Serve Uses

func Serve(w http.ResponseWriter, req *http.Request, handler func(ws *Conn))

Serve upgrades an HTTP connection to a websocket, and serves the given handler.

type Conn Uses

type Conn struct {
    *websocket.Conn
}

Conn wraps a gorilla/websocket.Conn, providing additional Juju-specific functionality.

func (*Conn) SendInitialErrorV0 Uses

func (conn *Conn) SendInitialErrorV0(err error) error

SendInitialErrorV0 writes out the error as a params.ErrorResult serialized with JSON with a new line character at the end.

This is a hangover from the initial debug-log streaming endpoint where the client read the first line, and then just got a stream of data. We should look to version the streaming endpoints to get rid of the trailing newline character for message based connections, which is all of them now.

Directories

PathSynopsis
websockettest

Package websocket imports 8 packages (graph) and is imported by 6 packages. Updated 2019-02-06. Refresh now. Tools for package owners.