Skip to content

Frequently asked questions

Marcel Prestel edited this page Feb 1, 2018 · 7 revisions

Overview

Questions

I'm getting the exception WebsocketNotConnectedException. What should I do?

This exception indicates that the connection is not yet established. Due to that reason you are not allowed to send any message to the other endpoint. You can do one of two things to avoid this exception:

  1. Check, if the connection is open and ready to send messages with isOpen()
  2. Use the blocking method connectBlocking(), which is blocking till a connection is established (or an error occurred)

How can I add additional headers to my WebSocketClient connection?

You can add additional headers (like Origin or Cookie) to your handshake, please check out this example here.

How can I add additional headers to my WebSocketServer response?

You can add additional headers (like Access-Control-Allow-Origin) to your handshake, please check out this example here.