WebSocket command line client
By Pavel Bucek-Oracle on Jul 08, 2013
Tyrus 1.1 brings new feature - simple command line client, which can be useful in many scenarios. You can use it for simple development testing, sanity testing or for monitoring of your deployed endpoints.
How to use:
- Download latest tyrus-client-cli binary (current version is 1.1):
# you can use wget .. or anything else you like: wget http://search.maven.org/remotecontent?filepath=org/glassfish/tyrus/ext/tyrus-client-cli/1.1/tyrus-client-cli-1.1.jar -O ./tyrus-client-cli-1.1.jar
- Execute downloaded binary
java -jar ./tyrus-client-cli-1.1.jar --help
that should print out usage information. Tyrus CLI client currently supports sending text messages and pings to one opened endpoint + you can close current session and connect to another one within one run. (If you try to open another connection while having another one already connected, close will be invoked automatically, so you will be still talking only to one endpoint).
$ java -jar ./tyrus-client-cli-1.1.jar ws://echo.websocket.org # Connecting to ws://echo.websocket.org... # Connected in session e303ad22-c5af-4bc3-9384-58ce6832ae94 session e303...ae94> ping # pong-message session e303...ae94> send tyrus-test-message # text-message: tyrus-test-message session e303...ae94> close # closed: CloseReason[1000,no reason given] # Session closed
note: lines starting with hash '#' symbol are generated from the client runtime, "# text-message: ..." means text message was received, etc.
This utility can be improved, please let us know if you have any suggestions about what feature would you like to add.
Many thanks to Gerard Davison for contributing main functionality of this module!