Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skibz/rl-socket-client
https://github.com/skibz/rl-socket-client
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/skibz/rl-socket-client
- Owner: skibz
- License: mit
- Created: 2015-02-24T13:31:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-25T22:21:08.000Z (almost 10 years ago)
- Last Synced: 2024-04-25T03:44:18.522Z (9 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 211 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## rl-socket-client: the readline socket client
[![Build Status](https://travis-ci.org/io-digital/rl-socket-client.svg)](https://travis-ci.org/io-digital/rl-socket-client) [![Coverage Status](https://coveralls.io/repos/io-digital/rl-socket-client/badge.svg)](https://coveralls.io/r/io-digital/rl-socket-client) [![Dependency Status](https://david-dm.org/io-digital/rl-socket-client.svg)](https://david-dm.org/io-digital/rl-socket-client) [![devDependency Status](https://david-dm.org/io-digital/rl-socket-client/dev-status.svg)](https://david-dm.org/io-digital/rl-socket-client#info=devDependencies)
[![NPM](https://nodei.co/npm/rl-socket-client.png?compact=true)](https://nodei.co/npm/rl-socket-client/)
we ought to just pretend it stands for [rocketlauncher](http://ioquake3.org/wp/wp-content/themes/ioq3-deboy/explodedView.png)-socket-client. that's way cooler, right?
this module was designed for apps that require a basic tty interface for socket programs - a tcp chat client, for instance. it affords tab-completion and a simple api.
#### api
- `#connect()`: initiate a connection to the given `host` and `port`
- `#on(event)`: currently the only event emitted is `connected`
- `#write(text)`: programmatically send `text` over the wire#### usage
```js
var rlsc = require('rl-socket-client');new rlsc({
host: '192.168.128.100',
port: 1829,
prompt: '% ',
lineEnding: '\n',
connect: true,
completions: ['ls', 'pwd', 'cat', 'echo']
});// or
var client = new rlsc({
host: '192.168.128.100',
port: 1829
}).connect();client.on('connected', function() {
client.write('blah blah...');
});
```