new ChannelPoll()
Wrapper around channels poll endpoint which implements EventEmitter interface.
Use it via Channel poll method.
- Source:
 
Properties:
| Name | Type | Argument | Default | Description | 
|---|---|---|---|---|
timeout | 
            
            Number | 
                
                    <optional> | 
            
            
                300000 | 5 mins  | 
        
path | 
            
            String | 
                
                    <optional> | 
            
            
                null | request path  | 
        
lastId | 
            
            Number | 
                
                    <optional> | 
            
            
                null | used internally in for loop  | 
        
room | 
            
            Number | 
                
                    <optional> | 
            
            
                null | |
abort | 
            
            Boolean | 
                
                    <optional> | 
            
            
                false | used internally to conrole for loop  | 
        
Example
var poll = ChannelPoll.setConfig(config)({
  path: '/v1.1/instances/some-instance/channels/some-channel/poll/'
});
poll.on('start', function() {
  console.log('poll::start');
});
poll.on('stop', function() {
  console.log('poll::stop');
});
poll.on('message', function(message) {
  console.log('poll::message', message);
});
poll.on('custom', function(message) {
  console.log('poll::custom', message);
});
poll.on('create', function(data) {
  console.log('poll::create', data);
});
poll.on('delete', function(data) {
  console.log('poll::delete', data);
});
poll.on('update', function(data) {
  console.log('poll::update', data);
});
poll.on('error', function(error) {
  console.log('poll::error', error);
});
poll.start();