🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

imposter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imposter

Stand in for REST with WebSockets and save your self connection and DNS latency.

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Overview

This is a very simple service that will relay HTTP over WebSockets. The basic idea -- and it works -- is that you cut down the HTTP connection and DNS time for REST APIs by tunneling them through a WebSocket.

So -- it's magical speed sauce to turn your REST API to 11.

Usage

You run this as a server, just grab and and feed it an npm start. It works best when you put it LAN-local to your REST services, on the same host is the best of all.

Then, you connect to it with a WebSocket, and send along messages that encapsualte a call to request.

var s = new WebSocket('ws://yourserver')
s.send({
verb: 'GET',
url: 'http://yourserver/restapi'
});

//...
//emits messages that add on .text, .statusCode, and .responseHeaders

You can pass along any other properties on the sent messages and they will simply be echoed back, this is really handy way to have completion tokens to look up for promises or message callbacks.

FAQs

Package last updated on 17 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts