Skip to content

Commit

Permalink
better docs for client constructors: endpoint constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Jul 22, 2023
1 parent 4aa6e7f commit fadc754
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ type Client struct {
}

// NewJsonClient initializes Client which uses JSON-based protocol internally.
// After client initialized call Client.Connect method.
// Use Client.NewSubscription to create Subscription objects.
// After client initialized call Client.Connect method. Use Client.NewSubscription to
// create Subscription objects.
// The provided endpoint must be a valid URL with ws:// or wss:// scheme – otherwise
// NewJsonClient will panic.
func NewJsonClient(endpoint string, config Config) *Client {
return newClient(endpoint, false, config)
}

// NewProtobufClient initializes Client which uses Protobuf-based protocol internally.
// After client initialized call Client.Connect method.
// Use Client.NewSubscription to create Subscription objects.
// After client initialized call Client.Connect method. Use Client.NewSubscription to
// create Subscription objects.
// The provided endpoint must be a valid URL with ws:// or wss:// scheme – otherwise
// NewProtobufClient will panic.
func NewProtobufClient(endpoint string, config Config) *Client {
return newClient(endpoint, true, config)
}
Expand Down

0 comments on commit fadc754

Please sign in to comment.