title: Why does Jupyter notebook fail to authenticate WebSocket connection?
body: <p>I am creating a fresh Python 3 virtual environment with a Jupyter notebook server using the following commands:</p>
  
  <pre><code>virtualenv env -p python3
  . env/bin/activate
  pip install jupyter
  jupyter notebook
  </code></pre>
  
  <p>These all run successfully. But when I try to create a new notebook, I get a WebSocket authentication error and am unable to create the notebook. The client says</p>
  
  <blockquote>
    <p>A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.</p>
  </blockquote>
  
  <p>Here is the log from the Jupyter notebook server:</p>
  
  <pre><code>[I 22:50:23.085 NotebookApp] The port 8888 is already in use, trying another port.
  [I 22:50:23.110 NotebookApp] Serving notebooks from local directory: /tmp
  [I 22:50:23.110 NotebookApp] 0 active kernels 
  [I 22:50:23.110 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/?token=b4d69926e308334a4ca121d3ceaa0dfa9f1ba93312770f88
  [I 22:50:23.110 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
  [I 22:50:36.778 NotebookApp] Accepting one-time-token-authenticated connection from 127.0.0.1
  [I 22:52:01.083 NotebookApp] Creating new notebook in 
  [W 22:52:06.372 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20161215225022 (127.0.0.1) 38.39ms referer=http://localhost:8889/notebooks/Untitled.ipynb?kernel_name=python3
  [I 22:52:06.855 NotebookApp] Kernel started: 7b5db30f-e2b2-48dc-9ec8-2aa9bd63b604
  [W 22:52:07.130 NotebookApp] Couldn't authenticate WebSocket connection
  [W 22:52:07.140 NotebookApp] 403 GET /api/kernels/7b5db30f-e2b2-48dc-9ec8-2aa9bd63b604/channels?session_id=277CA36E71FA431C922EE9F8AEFF6261 (127.0.0.1) 14.42ms referer=None
  [W 22:52:08.435 NotebookApp] Couldn't authenticate WebSocket connection
  [W 22:52:08.446 NotebookApp] 403 GET /api/kernels/7b5db30f-e2b2-48dc-9ec8-2aa9bd63b604/channels?session_id=277CA36E71FA431C922EE9F8AEFF6261 (127.0.0.1) 16.36ms referer=None
  WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
  [W 22:52:10.619 NotebookApp] Couldn't authenticate WebSocket connection
  [W 22:52:10.622 NotebookApp] 403 GET /api/kernels/7b5db30f-e2b2-48dc-9ec8-2aa9bd63b604/channels?session_id=277CA36E71FA431C922EE9F8AEFF6261 (127.0.0.1) 10.53ms referer=None
  [W 22:52:14.657 NotebookApp] Couldn't authenticate WebSocket connection
  [W 22:52:14.666 NotebookApp] 403 GET /api/kernels/7b5db30f-e2b2-48dc-9ec8-2aa9bd63b604/channels?session_id=277CA36E71FA431C922EE9F8AEFF6261 (127.0.0.1) 15.54ms referer=None
  </code></pre>
  
  <p>What does this error mean and how can I resolve it?</p>
  
  <p>I am using Ubuntu 16.10, Python 3.5.2, and Jupyter 4.2.1.</p>