title: Websocket server Spring Boot
body: <p>I am getting below error on testing WebSocket ServerEndPoint through Google Chrome.</p>
  
  <blockquote>
    <p>2018-01-26 04:27:02 [http-nio-8090-exec-5] DEBUG
    o.a.coyote.http11.Http11Processor - Error parsing HTTP request header
    "java.io.EOFException: null   at
    org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1250)
      at
    org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1190)
      at
    org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:717)
      at
    org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:366)
      at
    org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687)
      at
    org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at
    org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      at
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
      at
    org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:748)</p>
  </blockquote>
  
  <p>I search it on Google and found, it happened when your URL too long but in my case it's not.</p>
  
  <p>EndPoint URL: <code>ws://localhost:8090/ExchangeService</code>. The version of Tomcat embed inside Spring Boot is 8.5.23</p>
  
  <p>Here is ServerEndPoint</p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.socket.config.annotation.EnableWebSocket;
  import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
  import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
  
  @Configuration
  @EnableWebSocket
  public class WebSocketConfig  implements WebSocketConfigurer {
  
      @Autowired
      private ApplicationContext context;
  
      public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(context.getBean(ExchangeService.class), "/ExchangeService"); }
  
  }
  </code></pre>