Show / Hide Table of Contents

Class WebSocketProtocol

Well-known WebSocket sub-protocols used by the Kubernetes API.

Inheritance
object
WebSocketProtocol
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: k8s
Assembly: KubernetesClient.dll
Syntax
public static class WebSocketProtocol

Fields

View Source

Base64ChannelWebSocketProtocol

The Websocket subprotocol "base64.channel.k8s.io" base64 encodes each message with a character indicating the channel number (zero indexed) the message was sent on. Messages in both directions should prefix their messages with this channel char. When used for remote execution, the channel numbers are by convention defined to match the POSIX file-descriptors assigned to STDIN, STDOUT, and STDERR ('0', '1', and '2'). The data received on the server is base64 decoded (and must be be valid) and data written by the server to the client is base64 encoded.

Example client session:

CONNECT http://server.com with subprotocol "base64.channel.k8s.io"
WRITE []byte{48, 90, 109, 57, 118, 67, 103, 111, 61} # send "foo\n" (base64: "Zm9vCgo=") on channel '0' (STDIN)
READ  []byte{49, 67, 103, 61, 61} # receive "\n" (base64: "Cg==") on channel '1' (STDOUT)
CLOSE
Declaration
public const string Base64ChannelWebSocketProtocol = "base64.channel.k8s.io"
Field Value
Type Description
string
View Source

ChannelWebSocketProtocol

The Websocket subprotocol "channel.k8s.io" prepends each binary message with a byte indicating the channel number (zero indexed) the message was sent on. Messages in both directions should prefix their messages with this channel byte. When used for remote execution, the channel numbers are by convention defined to match the POSIX file-descriptors assigned to STDIN, STDOUT, and STDERR (0, 1, and 2). No other conversion is performed on the raw subprotocol - writes are sent as they are received by the server.

Example client session:

CONNECT http://server.com with subprotocol "channel.k8s.io"
WRITE []byte{0, 102, 111, 111, 10} # send "foo\n" on channel 0 (STDIN)
READ  []byte{1, 10}                # receive "\n" on channel 1 (STDOUT)
CLOSE
Declaration
public const string ChannelWebSocketProtocol = "channel.k8s.io"
Field Value
Type Description
string
View Source

V4Base64WebsocketProtocol

v4ProtocolHandler implements the V4 protocol version for streaming command execution. It only differs in from v3 in the error stream format using an json-marshaled metav1.Status which carries the process' exit code.

Declaration
public const string V4Base64WebsocketProtocol = "v4.base64.channel.k8s.io"
Field Value
Type Description
string
View Source

V4BinaryWebsocketProtocol

v4ProtocolHandler implements the V4 protocol version for streaming command execution. It only differs in from v3 in the error stream format using an json-marshaled metav1.Status which carries the process' exit code.

Declaration
public const string V4BinaryWebsocketProtocol = "v4.channel.k8s.io"
Field Value
Type Description
string
  • View Source
In this article
Back to top Generated by DocFX