new WatchEmitter(response, options, logger)
Event Emitter for Watch Events
Initialize a new WatchEmitter
object.
Parameters:
Name | Type | Description |
---|---|---|
response |
KubernetesResource | KubernetesList | Initial response body |
options |
object | Request options for watch socket |
logger |
Fires:
Extends
- EventEmitter
Members
-
initialState :KubernetesResource|KubernetesList
-
Initial state of the watched API resource
Type:
-
options :Object
-
Request options for the watch socket
Type:
- Object
Properties:
Name Type Description qs
object Properties
Name Type Description resourceVersion
string Last known version of the API resource
-
started :boolean
-
If true then the watch socket has been started
Type:
- boolean
Methods
-
start(retryCount, force)
-
Initialize the watch socket for the WatchEmitter
Events will not be sent by the WatchEmitter until this method is called. This allows the caller to set up all event listeners without missing any events.
By default the WatchEmitter will always attempt to reconnect automatically whenever a timeout occurs on the watch socket. This behavior can be changed by specifying the desired
retryCount
parameter. If set, the WatchEmitter will only attempt to reconnect a maximum ofretryCount
times.By default this method will only operate once per WatchEmitter object. Repeated calls will simply return immediately. Set the
force
parameter totrue
to initialize a new watch socket regardless. (WARNING: this may result in multiple events being fired per resource update!)Parameters:
Name Type Argument Default Description retryCount
number <optional>
<nullable>
Number of times to reconnect (null for infinite)
force
boolean <optional>
false Start even if already started