title: Web3 how to subscribe to events? Cannot read property 'currentProvider' of undefined
body: <p>I'm getting following error message when trying to subscribe to Events on a private ethereum blockchain:</p>
  
  <p><strong>Cannot read property 'currentProvider' of undefined</strong></p>
  
  <p><strong>Setup of Web3:</strong></p>
  
  <p><code>const Web3 = require("web3");
  this.web3 = new Web3(Web3.givenProvider || "ws://localhost:8545");</code></p>
  
  <p>Works:</p>
  
  <pre><code>this.factoryContract.getPastEvents(
    "allEvents",
    {
      fromBlock: 0,
      toBlock: "latest"
    },
    (err, events) =&gt; {
      console.log(events);
    }
  );
  </code></pre>
  
  <p>Throws error:</p>
  
  <pre><code>this.factoryContract.events
    .allEvents(
      {
        fromBlock: 0
      },
      (error, event) =&gt; {
        console.log(event);
      }
    )
    .on("data", event =&gt; {
      console.log(event);
    });
  
    this.factoryContract.events
    .TaskCreated(
      {
        fromBlock: 0
      },
      (error, event) =&gt; {
        console.log(event);
      }
    );
  </code></pre>
  
  <p>Any ideas how to fix that / what the error is?</p>
  
  <p>Node version: 10.14.2
  Web3: 1.0.0</p>