Documentation
¶
Index ¶
- Constants
- func Contains(slice []string, target string) bool
- func Debounce(inChan chan interface{}, outChan chan []interface{}, window time.Duration)
- func DistributeEvents(deliverChan <-chan interface{}, addSubscriber chan chan interface{})
- func GenerateUUID() string
- func IsValidUUID(id string) bool
- func LongPolling(w http.ResponseWriter, timeout time.Duration, ...)
- func Transport(pURL string) *http.Transport
Constants ¶
const ConfigfwdProxyPortURL = "configcompletefwdp"
Variables ¶
This section is empty.
Functions ¶
func Debounce ¶
Debounce() packs all elements received from channel `inChan` within the specified time window to one slice, and send it to channel `outChan` periodically. If nothing is received in the time window, nothing will be sent to `outChan`.
func DistributeEvents ¶
func DistributeEvents(deliverChan <-chan interface{}, addSubscriber chan chan interface{})
distributeEvents() receives elements from deliverChan, and send them to subscribers Sending a `chan interface{}` to addSubscriber adds a new subscriber. It closes the subscriber channel after sending the element. `go DistributeEvents(deliverChan, addSubscriber)` should be called during API initialization. Any subscriber sent to `addSubscriber` should be buffered chan.
func GenerateUUID ¶
func GenerateUUID() string
func IsValidUUID ¶
func LongPolling ¶
func LongPolling(w http.ResponseWriter, timeout time.Duration, addSubscriber chan chan interface{}, successHandler func(interface{}, http.ResponseWriter), timeoutHandler func(http.ResponseWriter))
LongPolling() subscribes to `addSubscriber`, and do long-polling until anything is delivered. It calls `successHandler` if receives a notification. It calls `timeoutHandler` if there's a timeout. `go DistributeEvents(deliverChan, addSubscriber)` must have been called during API initialization.
Types ¶
This section is empty.