title: Javax.websocket, error code = 1006, Reason = unexpected end of stream
body: <p>I am using javax.websockets to have a webSocket connection with Blockchain.info, except that it closes down after random intervals, and I can see the close reason as:</p>
  
  <p>'Unexpected end of stream', Error Code = 1006.</p>
  
  <p>I am not able to figure out why this occurs. I want the connection to never close unless the application tells it to. Here is the code:</p>
  
  <pre><code>private void initializeWebSocketSession(Session session)
  {
      WebSocketContainer container container = ContainerProvider.getWebSocketContainer();
      Session session = container.connectToServer(BlockchainWebSocketClient.class, URI.create("wss://ws.blockchain.info/inv"));               
  }
  
  public void onOpen(Session session) throws IOException
  {
      session.setMaxIdleTimeout(0);
      session.getBasicRemote().sendText("{\"op\":\"unconfirmed_sub\"}");
  }
  
  @OnMessage
  public void onMessage(String message, boolean isLastPartOfMessage)
  {
      // Some logic
  }
  </code></pre>