Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
cli server
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Aug 29, 2017
1 parent ecd0e07 commit 0dc2a55
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 206 deletions.
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,23 @@ $ streamhut -help

Commands:

post [options] post to a channel
listen [options] listen on a channel
post [options] post to a channel
listen [options] listen on a channel
server [options] start a streamhut server

Options:

-h, --help output usage information
-V, --version output the version number
-h, --host <host> host URL
--not-secure not using SSL.
-h, --host <host> host name
-p, --port <port> host port
-n, --not-secure not using SSL.
-c, --channel <id> channel ID
-t, --text <text> text to send
-f, --file <filepath> file to send

```

**Listening on a channel**
**Listening on a channel:**

```bash
$ streamhut listen -h streamhut.net -c yo
Expand All @@ -97,27 +99,25 @@ hello

```

**Posting text data to a channel**
**Posting text data to a channel:**

```bash
$ streamhut post -h streamhut.net -c yo -t "hello"
posting data to wss://streamhut.net/yo:

hello

```

**Posting file data to a channel**
**Posting file data to a channel:**

```bash
$ streamhut post -h streamhut.net -c yo -f hello.txt
posting data to wss://streamhut.net/yo:

hello.txt

```

**Pipe realtime stdout to streamhut xterm using [`netcat`](https://en.wikipedia.org/wiki/Netcat)**
**Pipe realtime stdout to streamhut xterm using [`netcat`](https://en.wikipedia.org/wiki/Netcat):**

```bash
$ while true; do date; sleep 1; done | nc streamhut.net 1337
Expand All @@ -126,6 +126,21 @@ Streaming to: https://streamhut.net/dsa

<img src="./screenshots/netcat.gif" width="500">

**Starting a streamhut server on localhost:**

```bash
$ streamhut server -p 1336
HTTP/WebSocket server on port: 1336
Netcat port: 1337
```

Then specify local host and port to connect:

```bash
$ streamhut listen -h 127.0.0.1 -p 1336 -n -c yo
connected to ws://127.0.0.1:1336/yo
```

## Development

Watch and build client scripts
Expand Down
2 changes: 1 addition & 1 deletion bin/streamhut.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node

const path = require(`path`);
require(path.join(__dirname, `../cli`))
require(path.join(__dirname, `../src/cli`))
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const server = require('./src/server')

server.start()
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streamhut",
"version": "0.0.4",
"version": "0.0.5",
"description": "Stream and send data, terminal to web and vice versa.",
"main": "server.js",
"bin": {
Expand All @@ -22,7 +22,7 @@
},
"scripts": {
"test": "echo 'TODO'",
"start": "node server.js",
"start": "node index.js",
"build": "browserify ./static/scripts/client.js > ./static/scripts/bundle.js",
"watch": "watchify ./static/scripts/client.js -o ./static/scripts/bundle.js"
},
Expand Down
168 changes: 0 additions & 168 deletions server.js

This file was deleted.

0 comments on commit 0dc2a55

Please sign in to comment.