Jetty Websocket

Jetty Websocket

Scheme: websocket
Syntax: websocket:host:port/resourceUri
Description: The websocket component provides websocket endpoints for communicating with clients using websocket.
Deprecated:false
Maven: org.apache.camel/camel-websocket/2.17.0.redhat-630187

The websocket component provides websocket endpoints for communicating with clients using websocket. This component uses Jetty as the websocket implementation.

Name Kind Group Required Default Type Enum Description
host path common 0.0.0.0 java.lang.String The hostname. The default value is 0.0.0.0. Setting this option on the component will use the component configured value as default.
port path common 9292 java.lang.Integer The port number. The default value is 9292. Setting this option on the component will use the component configured value as default.
resourceUri path common true java.lang.String Name of the websocket channel to use
allowedOrigins parameter common java.lang.String The CORS allowed origins. Use * to allow all.
bufferSize parameter common 8192 java.lang.Integer Set the buffer size of the websocketServlet, which is also the max frame byte size (default 8192)
crossOriginFilterOn parameter common boolean Whether to enable CORS
enableJmx parameter common boolean If this option is true, Jetty JMX support will be enabled for this endpoint. See Jetty JMX support for more details.
filterPath parameter common java.lang.String Context path for filtering CORS
maxBinaryMessageSize parameter common -1 java.lang.Integer Can be used to set the size in bytes that the websocket created by the websocketServlet may be accept before closing. (Default is -1 - or unlimited)
maxIdleTime parameter common 300000 java.lang.Integer Set the time in ms that the websocket created by the websocketServlet may be idle before closing. (default is 300000)
maxTextMessageSize parameter common java.lang.Integer Can be used to set the size in characters that the websocket created by the websocketServlet may be accept before closing.
minVersion parameter common 13 java.lang.Integer Can be used to set the minimum protocol version accepted for the websocketServlet. (Default 13 - the RFC6455 version)
sessionSupport parameter common boolean Whether to enable session support which enables HttpSession for each http request.
sslContextParameters parameter common org.apache.camel.util.jsse.SSLContextParameters To configure security using SSLContextParameters
staticResources parameter common java.lang.String Set a resource path for static resources (such as .html files etc).

The resources can be loaded from classpath, if you prefix with classpath:, otherwise the resources is loaded from file system or from JAR files.

For example to load from root classpath use classpath:., or classpath:WEB-INF/static

If not configured (eg null) then no static resource is in use.

bridgeErrorHandler parameter consumer boolean Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.
exceptionHandler parameter consumer (advanced) org.apache.camel.spi.ExceptionHandler To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
sendToAll parameter producer java.lang.Boolean To send to all websocket subscribers. Can be used to configure on endpoint level, instead of having to use the WebsocketConstants.SEND_TO_ALL header on the message.
exchangePattern parameter advanced InOnly org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the default exchange pattern when creating an exchange
synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

websocket consumer