第 4 章 AHC Websocket 组件

作为 Camel 版本 2.14 可用

ahc-ws 组件为通过 Websocket 与外部服务器通信的客户端提供基于 Websocket 的端点(作为打开与外部服务器的 websocket 连接的客户端)。
组件使用 AHC 组件,它使用了 Async Http Client 库。

Maven 用户需要将以下依赖项添加到其 pom.xml 中:

<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>

4.1. URI 格式

ahc-ws://hostname[:port][/resourceUri][?options]
ahc-wss://hostname[:port][/resourceUri][?options]

默认情况下,将端口 80 用于 ahc-wss,使用 443 作为 ahc-wss。