Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Async Http Client (AHC) Websocket Client ComponentAvailable as of Camel 2.14 The ahc-ws component provides Websocket based endpoints for a client communicating with external servers over Websocket (as a client opening a websocket connection to an external server). Maven users will need to add the following dependency to their <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-ahc-ws</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> URI Formatahc-ws://hostname[:port][/resourceUri][?options] ahc-wss://hostname[:port][/resourceUri][?options] Will by default use port 80 for ahc-ws and 443 for ahc-wss. AHC-WS OptionsAs the AHC-WS component is based on the AHC component, you can use the various configuration options of the AHC component. In additon there are these options
Writing and Reading Data over WebsocketAn ahc-ws endpoint can either write data to the socket or read from the socket, depending on whether the endpoint is configured as the producer or the consumer, respectively. Configuring URI to Write or Read DataIn the route below, Camel will write to the specified websocket connection. from("direct:start") .to("ahc-ws://targethost"); And the equivalent Spring sample: <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:start"/> <to uri="ahc-ws://targethost"/> </route> </camelContext> In the route below, Camel will read from the specified websocket connection. from("ahc-ws://targethost") .to("direct:next"); And the equivalent Spring sample: <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="ahc-ws://targethost"/> <to uri="direct:next"/> </route> </camelContext>
|