|
| 1 | += Simple WebSocket Client |
| 2 | +:revnumber: 0.1.0 |
| 3 | +:toc: |
| 4 | +:sectnums: |
| 5 | +:source-highlighter: prettify |
| 6 | +ifndef::env-github[] |
| 7 | +:icons: font |
| 8 | +:icon-set: far |
| 9 | +endif::[] |
| 10 | +ifdef::env-github[] |
| 11 | +:outfilesuffix: .adoc |
| 12 | +:!toc-title: |
| 13 | +:!sectnums: |
| 14 | +:caution-caption: :fire: |
| 15 | +:important-caption: :exclamation: |
| 16 | +:note-caption: :paperclip: |
| 17 | +:tip-caption: :bulb: |
| 18 | +:warning-caption: :warning: |
| 19 | +endif::[] |
| 20 | + |
| 21 | +:prj-version: {revnumber} |
| 22 | + |
| 23 | +image:https://img.shields.io/github/license/Axway-API-Management-Plus/ws-client-simple?style=plastic[] |
| 24 | +image:https://img.shields.io/github/v/release/Axway-API-Management-Plus/ws-client-simple?style=plastic[] |
| 25 | + |
| 26 | + |
| 27 | +== About the Tool |
| 28 | + |
| 29 | +The tool is a simple client for WebSocket. |
| 30 | +It simulates multiple client endpoints and sends/received messages to/from a WebSocket server. |
| 31 | +It can be used to test WebSocket listeners of an API Gateway. |
| 32 | +Check Axway API Gateway documentation to https://docs.axway.com/bundle/axway-open-docs/page/docs/apim_policydev/apigw_gw_instances/general_websocket/index.html[configure WebSocket connections]. |
| 33 | + |
| 34 | +== Usage |
| 35 | + |
| 36 | +The default behavior is to send a single text message to the `ws://echo.websocket.org` endpoint. |
| 37 | + |
| 38 | +[source,shell,subs="verbatim,attributes"] |
| 39 | +---- |
| 40 | +$ java -jar ws-simple-client-{prj-version}-jar-with-dependencies.jar |
| 41 | +INFO 10:29:06.452 - Connect to URI: ws://echo.websocket.org <1> |
| 42 | +INFO 10:29:07.512 - [1]: connected <2> |
| 43 | +INFO 10:29:07.513 - [1]: send - hello (#0) <3> |
| 44 | +INFO 10:29:07.628 - [1]: received - hello (#0) <4> |
| 45 | +INFO 10:29:09.522 - [1]: disconnected - 1 message(s) received <5> |
| 46 | +INFO 10:29:09.528 - all endpoints closed |
| 47 | +---- |
| 48 | +<1> Client connects to `ws://echo.websocket.org` |
| 49 | +<2> The ID of the endpoint is shown in brackets. |
| 50 | +Each simulated endpoint has its own identifier. |
| 51 | +<3> Client endpoint sends first message to server. |
| 52 | +<4> Client endpoint received first message from server |
| 53 | +<5> WebSocket closed and client endpoint disconnected |
| 54 | + |
| 55 | +To send two messages to the ws://192.168.56.201:8081/echo with three clients and delay of 500ms execute: |
| 56 | + |
| 57 | +[source,shell,subs="verbatim,attributes"] |
| 58 | +---- |
| 59 | +$ java -jar ws-simple-client-{proj-version}-jar-with-dependencies.jar --url ws://192.168.56.201:8081/echo --endpoints 3 --messages 2 --delay 500 |
| 60 | +INFO 10:33:07.377 - Connect to URI: ws://192.168.56.201:8081/echo |
| 61 | +INFO 10:33:08.426 - [1]: connected <1> |
| 62 | +INFO 10:33:08.672 - [2]: connected |
| 63 | +INFO 10:33:08.890 - [3]: connected <2> |
| 64 | +INFO 10:33:08.890 - [1]: send - hello (#0) |
| 65 | +INFO 10:33:08.896 - [2]: send - hello (#0) |
| 66 | +INFO 10:33:08.897 - [3]: send - hello (#0) |
| 67 | +INFO 10:33:09.039 - [2]: received - hello (#0) |
| 68 | +INFO 10:33:09.048 - [3]: received - hello (#0) |
| 69 | +INFO 10:33:09.048 - [1]: received - hello (#0) |
| 70 | +INFO 10:33:09.400 - [1]: send - hello (#1) |
| 71 | +INFO 10:33:09.401 - [2]: send - hello (#1) |
| 72 | +INFO 10:33:09.402 - [3]: send - hello (#1) |
| 73 | +INFO 10:33:09.516 - [3]: received - hello (#1) |
| 74 | +INFO 10:33:09.516 - [2]: received - hello (#1) |
| 75 | +INFO 10:33:09.517 - [1]: received - hello (#1) |
| 76 | +INFO 10:33:10.906 - [1]: disconnected - 2 message(s) received |
| 77 | +INFO 10:33:10.907 - [2]: disconnected - 2 message(s) received |
| 78 | +INFO 10:33:10.908 - [3]: disconnected - 2 message(s) received |
| 79 | +INFO 10:33:10.912 - all endpoints closed |
| 80 | +---- |
| 81 | +<1> First client endpoint connected to the server |
| 82 | +<2> Up to three endpoints are simulate with this call. |
| 83 | + |
| 84 | +== Installation |
| 85 | + |
| 86 | +For installation just download the latest version of the JAR from the https://github.com/orgs/Axway-API-Management-Plus/packages?repo_name=ws-client-simple[GitHub repository] and execute it (see example below): |
| 87 | + |
| 88 | +.Show help screen |
| 89 | +[source,shell,subs="verbatim,attributes"] |
| 90 | +---- |
| 91 | +$ java -jar ws-simple-client-{proj-version}-jar-with-dependencies.jar -h |
| 92 | +Usage: ws-client-simple [options] |
| 93 | + Options: |
| 94 | + -h, --help |
| 95 | + Show help screen. |
| 96 | + --url |
| 97 | + Target WebSocket endpoint |
| 98 | + Default: ws://echo.websocket.org |
| 99 | + --endpoints |
| 100 | + Number of parallel client endpoints |
| 101 | + Default: 1 |
| 102 | + --messages |
| 103 | + Number of messages to be send to the server |
| 104 | + Default: 1 |
| 105 | + --delay |
| 106 | + Delay between sending messages (milliseconds) |
| 107 | + Default: 1000 |
| 108 | +---- |
| 109 | + |
| 110 | + |
| 111 | +== Contributing |
| 112 | +Please read https://github.com/Axway-API-Management-Plus/Common/blob/master/Contributing.md[Contributing] for details on our code of conduct, and the process for submitting pull requests to us. |
| 113 | + |
| 114 | +== Team |
| 115 | +image:https://raw.githubusercontent.com/Axway-API-Management-Plus/Common/master/img/AxwayLogoSmall.png[Axway Logo] Axway Team |
| 116 | + |
| 117 | +== License |
| 118 | +link:./LICENSE[Apache License 2.0] |
0 commit comments