X

Pavel Bucek's Weblog

  • July 8, 2013

WebSocket command line client

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:

# 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).

Example:

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

Join the discussion

Comments ( 2 )
  • Tomer Ben David Wednesday, January 27, 2016

    Excellent! just what I was looking for!


  • guest Friday, April 22, 2016

    thanks


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha