Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Timeout controls the timeout in all the requests, can be changed after instantiating the client Timeout uint64 // Reattempt controls the amount of time the client waits to reconnect to the server after a failure Reattempt time.Duration // Will get all the events data EventsChan chan PollEvent // The HTTP client to perform the requests, any changes on this should be done prior to starting the client the first time HttpClient *http.Client // The username to be used for basic HTTP authentication BasicAuthUsername string // The password to be used for basic HTTP authentication BasicAuthPassword string // Whether or not logging should be enabled LoggingEnabled bool // contains filtered or unexported fields }
func NewClient ¶
Instantiate a new client to connect to a given URL and send the events into a channel The URL shouldn't contain any GET parameters although its fine if it contains some but category, since_time and timeout will be overriten stubChanData must either be an empty structure of the events data or a map[string]interface{} if the events do not follow a specific structure
type PollEvent ¶
type PollEvent struct { // Timestamp is milliseconds since epoch to match javascrits Date.getTime() Timestamp int64 `json:"timestamp"` Category string `json:"category"` // NOTE: Data can be anything that is able to passed to json.Marshal() Data json.RawMessage `json:"data"` }
Taken from https://github.com/jcuga/golongpoll/blob/master/events.go
type PollResponse ¶
Click to show internal directories.
Click to hide internal directories.