title: Connect to web socket (wss) with standard modules in Python?
body: <p>I have used Python external package, <a href="https://pypi.python.org/pypi/websocket-client/" rel="nofollow noreferrer"><code>websocket-client</code></a> to connect to a RESTful service that sends events.</p>
  
  <pre><code>from websocket import create_connection
  ws = create_connection("wss://machine:port/servicename/subscribe")
  
  for event in ws:
      print event
  
  ...getting events printed
  </code></pre>
  
  <p>I wonder whether the same functionality can be implemented using the core Python 2.7 or Python 3.5, without installing the external <code>websocket-client</code> package or any other 3rd party Python package. </p>
  
  <p>I have searched the Internet and those examples of code using Python <code>socket</code> module I've seen, refer to connections via <code>http</code> or <code>tcp</code> whereas I need to establish connection via <code>wss</code>.</p>