Documentation
¶
Overview ¶
Package coderは、Coder WebSocket(github.com/coder/websocket) を使ってWebSocket接続を行うためのパッケージです。
Index ¶
- func Dial(wsURL string, token *websocket.Token) (websocket.Conn, error)
- func DialConfig(c websocket.DialConfig) (websocket.Conn, error)
- func DialWithTLS(c websocket.DialConfig) (websocket.Conn, error)
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) CloseWithStatus(status transport.CloseStatus) error
- func (c *Conn) Ping(ctx context.Context) error
- func (c *Conn) Reader(ctx context.Context) (websocket.MessageType, io.Reader, error)
- func (c *Conn) SetUnderlyingConn(conn net.Conn)
- func (c *Conn) UnderlyingConn() net.Conn
- func (c *Conn) Writer(ctx context.Context, tp websocket.MessageType) (io.WriteCloser, error)
- type Dialer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialConfig ¶
func DialConfig(c websocket.DialConfig) (websocket.Conn, error)
DialCONFIGは、WebSocketのコネクションを開きます。
`tlsConfig` がnilの場合は無視します。
func DialWithTLS ¶
func DialWithTLS(c websocket.DialConfig) (websocket.Conn, error)
DialWithTLSは、WebSocketのコネクションを開きます。
DEPRECATED: 代わりに `DialConfig` を使用してください。
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Connは、 coder/websocketのConnのラッパーです。
func NewWithUnderlyingConn ¶
func NewWithUnderlyingConn(wsconn *cwebsocket.Conn, conn net.Conn) *Conn
NewWithUnderlyingConnは、underlying connを指定してConnを返却します。
func (*Conn) CloseWithStatus ¶
func (c *Conn) CloseWithStatus(status transport.CloseStatus) error
CloseWithStatus implements websocket.Conn.
func (*Conn) SetUnderlyingConn ¶
SetUnderlyingConnは、WebSocketの基盤となるnet.Connを設定します。 connがnilの場合、既存の設定は変更されません。
func (*Conn) UnderlyingConn ¶
UnderlyingConnは、WebSocketの基盤となるnet.Connを返します。 DialWithTCPCaptureで取得したnet.Connがある場合はそれを返し、ない場合はnilを返します。
func (*Conn) Writer ¶
func (c *Conn) Writer(ctx context.Context, tp websocket.MessageType) (io.WriteCloser, error)
Writerは、WebSocketのWriterを取得します。