Skip to content

Commit

Permalink
README.md: details about websocket server mode
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Mar 21, 2021
1 parent e3da904 commit 7b14b0d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Copyright: Daniel-Constantin Mierla (Asipto, https://www.asipto.com)

## Overview ##

**wsctl** is a websocket client to be used from command line. It is written in Go (Golang).
**wsctl** is a websocket client and basic server to be used from command line. It is written in Go (Golang).

While the common use case for websocket connections is between web browser and web server, there are situations where is more convenient to use a command line (e.g., testing, monitoring).

Expand All @@ -17,6 +17,13 @@ It was developed and tested for sending SIP requests over websocket to Kamailio

For SIP over websocket, it can do www-digest authentication if the server challenges with a 401/407 response.

As a webserver socket, **wsctl** offers a few basic services useful for testing, matching on URL path:

* `/echo` - copy received message back to the websocket connection and write a log with the message
* `/echo-only` - only copy what is received back to the websocket connection
* `/echo-reply` - prefix with `Replying-To: ` what is received and send back to the websocket connection
* `/log` - write a log with the message received on websocket connection

## Install ##

First install Go (http://golang.org). Once the Go environment is configured, the websocket package must be fetched locally:
Expand Down Expand Up @@ -161,6 +168,12 @@ JSON fields file.

Sending data over websocket connection has a timeout of 10 seconds. Receiving data from websocket connection has a timeout of 20 seconds. These values can be changed via command line parameters.

## WebSocket Server Mode ##

To be started as a WebSocket server, `wsctl` must be given `-http-srv` or `-https-srv` command
line parameter. Their value has to be `:PORT` to listen on all local IP address,
or `LOCALIP:PORT` to listen only on a specific local IP.

## Contributions ##

Contributions are welcome! Fork and do pull requests on https://github.com/miconda/wsctl .
Expand Down

0 comments on commit 7b14b0d

Please sign in to comment.