title: How can I know the type of error and response code from IOWebSocketChannel
body: <p>I am trying to know if the connection error is <code>Connection to 'some URL' was not upgraded to websocket</code>. Also identify response code. The server is emitting <code>401</code>.</p>
  <p>I need this to know if I need to refresh the token and then reconnect.</p>
  <pre class="lang-dart prettyprint-override"><code>final channel = IOWebSocketChannel.connect(Url)
  final sub = channel.stream.listen((data){
                                          //process data
                                       },
                                      onError: (error){
                                          //confirm this error failing to upgrade and
                                          // response code is 401
  
                                          // then refresh token and reconnect
                                       })
  </code></pre>