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 )
Serve upgrades an HTTP connection to a websocket, and serves the given handler.
Conn wraps a gorilla/websocket.Conn, providing additional Juju-specific functionality.
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.