Socket
Socket
Sign inDemoInstall

nssocket

Package Overview
Dependencies
2
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.6 to 0.3.7

2

lib/nssocket.js

@@ -428,3 +428,2 @@ /*

data = parsed.pop();
this.emit(['data'].concat(parsed), data)
}

@@ -437,2 +436,3 @@ catch (err) {

}
this.emit(['data'].concat(parsed), data);
};

@@ -439,0 +439,0 @@

{
"name": "nssocket",
"description": "An elegant way to define lightweight protocols on-top of TCP/TLS sockets in node.js",
"version": "0.3.6",
"version": "0.3.7",
"author": "Nodejitsu Inc <info@nodejitsu.com>",

@@ -6,0 +6,0 @@ "maintainers": [

@@ -1,12 +0,11 @@

# nssocket
# Synposis
An elegant way to define lightweight protocols on-top of TCP/TLS sockets in node.js
## Installation
# Motivation
Working within node.js it is very easy to write lightweight network protocols that communicate over TCP or TLS. The definition of such protocols often requires repeated (and tedious) parsing of individual TCP/TLS packets into a message header and some JSON body.
### Installing npm (node package manager)
```
curl http://npmjs.org/install.sh | sh
```
# Build Status
[![Build Status](https://secure.travis-ci.org/nodejitsu/nssocket.png)](http://travis-ci.org/nodejitsu/nssocket)
### Installing nssocket
# Installation
```

@@ -16,4 +15,3 @@ [sudo] npm install nssocket

## Motivation
Working within node.js it is very easy to write lightweight network protocols that communicate over TCP or TLS. The definition of such protocols often requires repeated (and tedious) parsing of individual TCP/TLS packets into a message header and some JSON body.
# How it works

@@ -36,6 +34,3 @@ With `nssocket` this tedious bookkeeping work is done automatically for you in two ways:

## Usage
So get on with it right? _SHOW ME SOME CODE!_
### Simple Example
## Simple Example
``` js

@@ -77,3 +72,3 @@ var nssocket = require('nssocket');

### Reconnect
## Reconnect Example
`nssocket` exposes simple options for enabling reconnection of the underlying socket. By default, these options are disabled. Lets look at a simple example:

@@ -113,11 +108,11 @@

### Methods
# API
#### socket.send(event, data)
### socket.send(event, data)
Writes `data` to the socket with the specified `event`, on the receiving end it will look like: `JSON.stringify([event, data])`.
#### socket.on(event, callback)
### socket.on(event, callback)
Equivalent to the underlying `.addListener()` or `.on()` function on the underlying socket except that it will permit all `EventEmitter2` wildcards and namespaces.
#### socket.data(event, callback)
### socket.data(event, callback)
Helper function for performing shorthand listeners namespaced under the `data` event. For example:

@@ -133,6 +128,6 @@

#### socket.end()
### socket.end()
Closes the current socket, emits `close` event, possibly also `error`
#### socket.destroy()
### socket.destroy()
Remove all listeners, destroys socket, clears buffer. It is recommended that you use `socket.end()`.

@@ -147,4 +142,4 @@

#### Author: [Nodejitsu](http://www.nodejitsu.com)
#### Contributors: [Paolo Fragomeni](http://github.com/hij1nx), [Charlie Robbins](http://github.com/indexzero), [Jameson Lee](http://github.com/drjackal)
### Author: [Nodejitsu](http://www.nodejitsu.com)
### Contributors: [Paolo Fragomeni](http://github.com/hij1nx), [Charlie Robbins](http://github.com/indexzero), [Jameson Lee](http://github.com/drjackal)

@@ -154,2 +149,2 @@ [0]: http://github.com/hij1nx/eventemitter2

[2]: http://vowsjs.org
[3]: http://npmjs.org
[3]: http://npmjs.org

@@ -55,3 +55,4 @@ /*

HOST = "127.0.0.1",
PIPE = path.join(__dirname, "fixtures", "nssocket.sock");
PIPE = path.join(__dirname, "fixtures", "nssocket.sock"),
HOSTNAME = "localhost";

@@ -62,2 +63,3 @@ vows.describe('nssocket/create-server').addBatch({

"with `(PORT, HOST)` arguments": getBatch(PORT + 1, HOST),
"with `(PORT, HOSTNAME)` argument": getBatch(PORT + 2, HOSTNAME),
"with `(PIPE)` argument": getBatch(PIPE)

@@ -64,0 +66,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc