Adds HTTP style methods to Rapport, intended for use with rapport-router.
Installation
Node: Install the plugin via NPM: npm install --save rapport-http
Browser: Attach rapport.http.min.js
to your HTML page
Then add the plugin to rapport:
// GloballyRapport; // In Node.jsRapport; // In the browser // Or to a instance; // In Node.js; // In the browser
Usage
This plugin adds methods to the Rapport socket. To use it, simply call them:
const ws = rapport; // Create a request on /usersws;ws;ws;ws;ws;ws; // Add query parameters (each call appends to the query string)ws;ws;ws; // Add a bodywsbody key: value ; // Merged with any existing body objectswsbody'some string'; // Overwrites an existing bodywsbody1 2 3; // Also overwrites an existing body // Add a request timeoutws; // Times out in 3 seconds // Send it!ws; // With a promisews; // Or a callback // All together nowws ;