A simple command line websocket utility for piping messages to and from a browser.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7982dc5 Feb 23, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore added git ignore Feb 1, 2016
LICENSE Initial commit Feb 1, 2016
Makefile added warnings and optimization flag to compilation Feb 4, 2016
README.md Update README.md Feb 23, 2016
build.sh added --install option Feb 4, 2016
pipe.c Added initial message option Feb 23, 2016
test.html added slightly more flushed out demonstration of the test.html Feb 4, 2016

README.md

webpipe

A simple command line websocket utility for piping messages to and from a browser

Server

while true; do date; sleep 1; done | webpipe -f test.html

Client

webpipe -i '{"type":"subscribe","product_id":"BTC-USD"}' wss://ws-feed.exchange.coinbase.com|sed -n 's/.*price":"\([0-9\.]*\)".*/\1/p'

Installation

git clone https://github.com/emgram769/webpipe && cd webpipe
./build.sh --install

Or you can install the latest version of libwebsockets (source here) and run make instead of ./build.sh.

Try it out

./build.sh
./webpipe -f test.html

Navigate to localhost:8000 and open your browser's console. Type what ever you'd like into your terminal.

Use it as a simple chat

In one shell:

webpipe

and in another:

webpipe localhost:8000

Usage

####Client:

webpipe somesite.com

for example

webpipe -i '{"type":"subscribe","product_id":"BTC-USD"}' wss://ws-feed.exchange.coinbase.com

####Server:

webpipe -p 5000 -f file.html

Flags

  • -p [port] to specify a port number to serve on.
  • -f [file] to host an HTML file (hardcoded mime-type).
  • -i [message] to send a message once the server is connected. This is useful for subscription based services.
  • -s to attempt to connect with SSL.
  • -D [delimiter] to specify a character other than \n as a delimiter.
  • -d to see debug messages in stderr.
  • -U [max users] to specify the maximum number of connections.
  • -B [max buffer size] to specify the maximum size of any sent message.