Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ClientTypeHeader is the HTTP header where the client type resides. ClientTypeHeader = "pubsub" // ClientNameHeader is the HTTP header where the client's program name is stored. ClientNameHeader = "pubsub-client-name" // CloseDeadline is the time to wait to gracefully closing something. After that, it's closed regardless. CloseDeadline = time.Second * 5 // PongDeadline is the number of seconds to wait before the next pong. PongDeadline = time.Second * 5 )
Variables ¶
View Source
var ( // ErrClosedByServer indicates that the client was closed by the server. ErrClosedByServer = errors.New("the client was closed by the server") )
Functions ¶
func CloseWebSocket ¶
CloseWebSocket closes the client's websocket. It return the first error in the chain.
Types ¶
type Options ¶
type Options struct { // ClientName is the name of the client's program. It is used in the ClientNameHeader HTTP header. ClientName string // CloseDeadline is the time to wait to gracefully closing something. After that, it's closed regardless. CloseDeadline *time.Duration // InitialHeaders are the headers send during the first request to create a websocket. InitialHeaders http.Header // PongDeadline is the websocket write deadline to set when expecting a response. PongDeadline *time.Duration // WebsocketDialer is the *websocket.Dialer to use, if the default isn't sufficient. WebsocketDialer *websocket.Dialer }
Options represents information used to connect a publisher or subscriber to a subscription that already has default values.
func FlattenClientOptions ¶
FlattenClientOptions takes in a slice of Options, uses the highest index of their fields' values to create one Options.
Click to show internal directories.
Click to hide internal directories.