Skip to content

randomnerd/socket-observer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

socket-observer

Simple RXJS wrapper around node's net.Socket.

Installation

npm install --save socket-observer

Example usage

With user-provided socket:

import { createConnection } from 'net';
import { socketObserver } from 'socket-observer';

const socket = createConnection({
    host: 'example.com',
    port: 80
});
const oSocket = socketObserver(socket);
oSocket.down.subscribe(console.log);
oSocket.up('GET / HTTP/1.1\nHost: example.com\n\n');

Or using createConnection helper:

import { createConnection } from 'socket-observer';

const oSocket = createConnection({
    host: 'example.com',
    port: 80
});
oSocket.down.subscribe(console.log);
oSocket.up('GET / HTTP/1.1\nHost: example.com\n\n');

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published