0.0.8 • Published 10 years ago

net-event v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

net-event

easily extend node net/tls modules with events

Usage examples

Client

var netEvent = require('net-event');
var socket = new netEvent({
    host: 'localhost',
    port: 8080
});
socket.on('helloResponse', function(data) {
    console.log('got JSON data: ' + JSON.stringify(data));
});

Server

var netEvent = require('net-event');
var server = new netEvent({
    server: true,
    port: 8080
});
server.on('open', function(socket) {
    socket.send('helloResponse', {
        'text': 'Hello World!'
    });
});

See the provided example_server.js and example_client.js programs for more detailed examples.

Examples can be tested by running:

  • ./gen_cert.sh
  • node example_server.js
  • node example_client.js

Note that unlike in the examples, your code should require('net-event')

Protocol

msg_len["eventname",JSON]

Example:

37["helloTest",{"text":"Hello world!"}]
0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago