Documentation ¶
Overview ¶
Package ws implements the Websocket protocol binding
Index ¶
- Constants
- Variables
- func WithCloseReason(ctx context.Context, code websocket.StatusCode, reason string) context.Context
- type ClientProtocol
- func (c *ClientProtocol) Close(ctx context.Context) error
- func (c *ClientProtocol) Receive(ctx context.Context) (binding.Message, error)
- func (c *ClientProtocol) Send(ctx context.Context, m binding.Message, transformers ...binding.Transformer) error
- func (c *ClientProtocol) UnsafeReceive(ctx context.Context) (binding.Message, error)
Constants ¶
View Source
const JsonSubprotocol = "cloudevents.json"
Variables ¶
View Source
var SupportedSubprotocols = []string{JsonSubprotocol}
Functions ¶
func WithCloseReason ¶
Types ¶
type ClientProtocol ¶
type ClientProtocol struct {
// contains filtered or unexported fields
}
ClientProtocol implements protocol.Receiver, protocol.Sender and protocol.Closer. Note: when you use client.StartReceiver with this protocol, you can use just one goroutine to poll this protocol, because the protocol itself cannot handle multiple received messages at same time (WS has no multiplexing!)
func Dial ¶
func Dial(ctx context.Context, u string, opts *websocket.DialOptions) (*ClientProtocol, error)
Dial wraps websocket.Dial and creates the ClientProtocol.
func NewClientProtocol ¶
func NewClientProtocol(c *websocket.Conn) (*ClientProtocol, error)
NewClientProtocol wraps a websocket.Conn in a type that implements protocol.Receiver, protocol.Sender and protocol.Closer. Look at ClientProtocol for more details.
func (*ClientProtocol) Send ¶
func (c *ClientProtocol) Send(ctx context.Context, m binding.Message, transformers ...binding.Transformer) error
func (*ClientProtocol) UnsafeReceive ¶
UnsafeReceive is like Receive, except it doesn't guard from multiple invocations from different goroutines.
Click to show internal directories.
Click to hide internal directories.