New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

feedme-server-core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feedme-server-core - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

4

actionrequest.js

@@ -9,3 +9,3 @@ "use strict";

/**
* Represents an a client Action request.
* Represents an Action message.
* @typedef {Object} ActionRequest

@@ -15,3 +15,3 @@ */

/**
* Factory function. Assumes valid args.
* Factory function.
* @param {string} clientId

@@ -18,0 +18,0 @@ * @param {string} actionCallbackId

@@ -15,4 +15,3 @@ "use strict";

/**
* Emitted with the action event, enabling the application to indicate how
* the library should respond to an Action message.
* Represents an ActionResponse message.
* @typedef {Object} ActionResponse

@@ -22,3 +21,3 @@ */

/**
* Factory function. Assume valid args.
* Factory function.
* @param {Server} server

@@ -32,4 +31,4 @@ * @param {ActionRequest} areq

/**
* Reference to the server. Null after a call to actionResponse.success(),
* actionResponse.failure(), or actionResponse._neutralize().
* Reference to the server. Null after a call to success(),
* failure(), or _neutralize().
* @memberof ActionResponse

@@ -98,4 +97,4 @@ * @instance

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The actionResponse.success() or actionResponse.failure() method has already been called.");
} // Update state to reflect app response (save server reference)
throw new Error("ALREADY_RESPONDED: The success() or failure() method has already been called.");
} // Update state to reflect app response

@@ -105,3 +104,3 @@

var s = this._server;
this._server = null; // If not neutralized, call the server function and neutralize
this._server = null; // If not neutralized, call the server function

@@ -113,3 +112,3 @@ if (!this._neutralized) {

/**
* Called by the application to return a ActionResponse indicating failure.
* Called by the application to return an ActionResponse indicating failure.
*

@@ -146,4 +145,4 @@ * After being neutralized, the first call to success() or failure() will

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The actionResponse.success() or actionResponse.failure() method has already been called.");
} // Update state to reflect app response (save server reference)
throw new Error("ALREADY_RESPONDED: The success() or failure() method has already been called.");
} // Update state to reflect app response

@@ -153,3 +152,3 @@

var s = this._server;
this._server = null; // If not neutralized, call the server function and neutralize
this._server = null; // If not neutralized, call the server function

@@ -181,3 +180,3 @@ if (!this._neutralized) {

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The actionResponse.success() or actionResponse.failure() method has already been called.");
throw new Error("ALREADY_RESPONDED: The success() or failure() method has already been called.");
} // Throw if already neutralized - bad server behavior

@@ -184,0 +183,0 @@

@@ -9,3 +9,3 @@ "use strict";

/**
* Represents a client feed close request.
* Represents a FeedClose message.
* @typedef {Object} FeedCloseRequest

@@ -15,3 +15,3 @@ */

/**
* Factory function. Assumes valid args.
* Factory function.
* @param {String} clientId

@@ -18,0 +18,0 @@ * @param {String} feedName

@@ -9,4 +9,3 @@ "use strict";

/**
* Emitted with the feedClose event, enabling the application to indicate when
* the library should respond to a FeedClose message.
* Represents a FeedCloseResponse message.
* @typedef {Object} FeedCloseResponse

@@ -16,3 +15,3 @@ */

/**
* Factory function. Assume valid args.
* Factory function.
* @param {Server} server

@@ -26,4 +25,4 @@ * @param {FeedCloseRequest} fcreq

/**
* Reference to the server. Null after a call to feedCloseResponse.success()
* or feedCloseResponse._neutralize().
* Reference to the server. Null after a call to success()
* or _neutralize().
* @memberof FeedCloseResponse

@@ -80,4 +79,4 @@ * @instance

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The feedCloseResponse.success() method has already been called.");
} // Update state to reflect app response (save server reference)
throw new Error("ALREADY_RESPONDED: The success() method has already been called.");
} // Update state to reflect app response

@@ -87,3 +86,3 @@

var s = this._server;
this._server = null; // If not neutralized, call the server function and neutralize
this._server = null; // If not neutralized, call the server function

@@ -115,3 +114,3 @@ if (!this._neutralized) {

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The feedCloseResponse.success() method has already been called.");
throw new Error("ALREADY_RESPONDED: The success() method has already been called.");
} // Throw if already neutralized - bad server behavior

@@ -118,0 +117,0 @@

@@ -9,3 +9,3 @@ "use strict";

/**
* Represents a client feed open request.
* Represents FeedOpen message.
* @typedef {Object} FeedOpenRequest

@@ -15,3 +15,3 @@ */

/**
* Factory function. Assumes valid args.
* Factory function.
* @param {String} clientId

@@ -23,7 +23,28 @@ * @param {String} feedName

function feedOpenRequestFactory(clientId, feedName, feedArgs) {
return {
clientId: clientId,
feedName: feedName,
feedArgs: feedArgs
};
var feedOpenRequest = {};
/**
* Client id associated with the request.
* @memberof FeedOpenRequest
* @instance
* @type {String}
*/
feedOpenRequest.clientId = clientId;
/**
* Name of the feed being opened.
* @memberof FeedOpenRequest
* @instance
* @type {String}
*/
feedOpenRequest.feedName = feedName;
/**
* Arguments for the feed being opened.
* @memberof FeedOpenRequest
* @instance
* @type {Object}
*/
feedOpenRequest.feedArgs = feedArgs;
return feedOpenRequest;
}

@@ -30,0 +51,0 @@

@@ -15,4 +15,3 @@ "use strict";

/**
* Emitted with the feedOpen event, enabling the application to indicate how
* the library should respond to a FeedOpen message.
* Represents a FeedOpenResponse message.
* @typedef {Object} FeedOpenResponse

@@ -22,3 +21,3 @@ */

/**
* Factory function. Assume valid args.
* Factory function.
* @param {Server} server

@@ -32,4 +31,4 @@ * @param {FeedOpenRequest} foreq

/**
* Reference to the server. Null after a call to feedOpenResponse.success(),
* feedOpenResponse.failure(), or feedOpenResponse._neutralize().
* Reference to the server. Null after a call to success(),
* failure(), or _neutralize().
* @memberof FeedOpenResponse

@@ -98,4 +97,4 @@ * @instance

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The feedOpenResponse.success() or feedOpenResponse.failure() method has already been called.");
} // Update state to reflect app response (save server reference)
throw new Error("ALREADY_RESPONDED: The success() or failure() method has already been called.");
} // Update state to reflect app response

@@ -105,3 +104,3 @@

var s = this._server;
this._server = null; // If not neutralized, call the server function and neutralize
this._server = null; // If not neutralized, call the server function

@@ -145,4 +144,4 @@ if (!this._neutralized) {

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The feedOpenResponse.success() or feedOpenResponse.failure() method has already been called.");
} // Update state to reflect app response (save server reference)
throw new Error("ALREADY_RESPONDED: The success() or failure() method has already been called.");
} // Update state to reflect app response

@@ -152,3 +151,3 @@

var s = this._server;
this._server = null; // If not neutralized, call the server function and neutralize
this._server = null; // If not neutralized, call the server function

@@ -180,3 +179,3 @@ if (!this._neutralized) {

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The feedOpenResponse.success() or feedOpenResponse.failure() method has already been called.");
throw new Error("ALREADY_RESPONDED: The success() or failure() method has already been called.");
} // Throw if already neutralized - bad server behavior

@@ -183,0 +182,0 @@

@@ -9,3 +9,3 @@ "use strict";

/**
* Represents a client handshake request.
* Represents a Handshake message.
* @typedef {Object} HandshakeRequest

@@ -15,3 +15,3 @@ */

/**
* Factory function. Assumes valid args.
* Factory function.
* @param {String} clientId

@@ -18,0 +18,0 @@ * @param {String} feedName

@@ -9,4 +9,3 @@ "use strict";

/**
* Emitted with the handshake event, enabling the application to indicate when
* the library should respond to a Handshake message.
* Represents a HandshakeResponse message.
* @typedef {Object} HandshakeResponse

@@ -16,3 +15,3 @@ */

/**
* Factory function. Assume valid args.
* Factory function.
* @param {Server} server

@@ -26,4 +25,4 @@ * @param {HandshakeRequest} hreq

/**
* Reference to the server. Null after a call to handshakeResponse.success()
* or handshakeResponse._neutralize().
* Reference to the server. Null after a call to success()
* or _neutralize().
* @memberof HandshakeResponse

@@ -80,4 +79,4 @@ * @instance

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The handshakeResponse.success() method has already been called.");
} // Update state to reflect app response (save server reference)
throw new Error("ALREADY_RESPONDED: The success() method has already been called.");
} // Update state to reflect app response

@@ -87,3 +86,3 @@

var s = this._server;
this._server = null; // If not neutralized, call the server function and neutralize
this._server = null; // If not neutralized, call the server function

@@ -115,3 +114,3 @@ if (!this._neutralized) {

if (this._appResponded) {
throw new Error("ALREADY_RESPONDED: The handshakeResponse.success() method has already been called.");
throw new Error("ALREADY_RESPONDED: The success() method has already been called.");
} // Throw if already neutralized - bad server behavior

@@ -118,0 +117,0 @@

@@ -31,3 +31,4 @@ "use strict";

*
* Takes a transport from outside, wraps it, and injects it into the server.
* Takes a transport from outside, wraps it, injects it into the server,
* and returns the server.
*

@@ -34,0 +35,0 @@ * The options parameter is identical to that taken by the server, but a

{
"name": "feedme-server-core",
"version": "0.0.3",
"version": "0.0.4",
"description": "A low-level Feedme server library for Node.js.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,12 +11,10 @@ [![Build Status](https://travis-ci.com/aarong/feedme-server-core.svg?branch=master)](https://travis-ci.com/aarong/feedme-server-core)

This library Exposes a flexible API for client conversation management that is
compliant with the
[Feedme specification](https://github.com/aarong/feedme-spec). It provides
minimal API sugar and is intended primarily as a foundation for other Feedme
server libraries with greater functionality. Application developers may be more
interested in [Feedme Node.js Server](https://github.com/aarong/feedme-server).
This library Exposes a simple and flexible API for client conversation
management that is compliant with the
[Feedme specification](https://github.com/aarong/feedme-spec). Application
developers may be more interested in
[Feedme Node.js Server](https://github.com/aarong/feedme-server).
[WebSocket](https://github.com/aarong/feedme-transport-websocket) and
[Socket.io](https://github.com/aarong/feedme-transport-socketio) transports are
maintained as a core part of the project. Both are supported by the
A [WebSocket](https://github.com/aarong/feedme-transport-ws) transport is
maintained as a core part of the project and is also supported by the
[Feedme Javascript Client](https://github.com/aarong/feedme-client).

@@ -78,8 +76,6 @@

The library expects the application to provide a transport, through which it
will accept client connections.
will accept client connections. To install the WebSocket transport:
```shell
npm install feedme-transport-websocket
# or
npm install feedme-transport-socketio
npm install feedme-transport-ws
```

@@ -91,3 +87,3 @@

const feedmeServerCore = require("feedme-server-core");
const wsTransport = require("feedme-transport-websocket/server");
const wsTransport = require("feedme-transport-ws/server");

@@ -99,13 +95,2 @@ const server = feedmeServerCore({

To initialize a server using the Socket.io transport:
```javascript
const feedmeServerCore = require("feedme-server-core");
const ioTransport = require("feedme-transport-socketio/server");
const server = feedmeServerCore({
transport: ioTransport({ url: "https://some.url/api/socketio" })
});
```
Once a server has been initialized, the application can listen for events and

@@ -132,5 +117,6 @@ start the server.

A transport object used to listen for and interact with clients. The transport
must satisfy the requirements laid out in the developer documentation.
must satisfy the requirements laid out in the
[developer documentation](DEV.md).
The application must not operate on the transport object directly and must not
Applications must not operate on the transport object directly and must not
pass a given transport object to more than one server instance.

@@ -142,4 +128,4 @@

Specifies how long to wait for a client to transmit a successful `Handshake`
message after connecting via the transport.
Specifies how long to wait for a client to transmit a valid and
library-compatible `Handshake` message after connecting via the transport.

@@ -155,5 +141,5 @@ If greater than 0, then the server will wait `handshakeMs` for a

Specifies the duration of feed termination windows. If greater than zero, then
termination windows last `terminationMs`. If set to zero, then termination
windows last for the duration of a client's connection.
Specifies feed termination window duration. If greater than zero, then
termination windows last `terminationMs`. If set to zero, then feed
termination windows last for the duration of a client's connection.

@@ -167,9 +153,9 @@ A termination window begins after a `FeedTermination` message has been

If the server receives a `FeedClose` message referencing a feed during its
If the server receives a `FeedClose` message referencing a feed during the
termination window, it will respond with a `FeedCloseResponse` indicating
success and will not emit a `feedClose` event. The server will expect the next
client message referencing the feed to be a `FeedOpen` and will respond with a
client message referencing the feed to be `FeedOpen` and will respond with a
`ViolationResponse` if it receives another `FeedClose`.
If the server receives a `FeedOpen` message referencing a feed during its
If the server receives a `FeedOpen` message referencing a feed during the
termination window, it will emit a `feedOpen` event as usual.

@@ -238,8 +224,10 @@

stoppage resulted from a transport error, then `err` takes the form
`err.message === "FAILURE: ..."`.
`err.message === "FAILURE: ..."` and matches the error emitted with the
`stopping` event.
#### connect
Emitted when a client connects on the transport and before any messages have
been exchanged.
Emitted when a client connects via the transport. Emitted before any messages
have been exchanged and, in particular, before a `Handshake` message has been
transmitted by the client.

@@ -257,2 +245,9 @@ Arguments passed to the listeners:

Arguments passed to the listeners:
1. `hreq` (Object) is a `HandshakeRequest` object describing the client request.
2. `hres` (Object) is a `HandshakeResponse` object enabling the application to
respond to the request.
If there is a listener attached to the `handshake` event, then the application

@@ -264,15 +259,8 @@ must call `hres.success()` to return a `HandshakeResponse` message to the

immediataly returns a `HandshakeResponse` message indicating success when a
valid and library-compatible `Handshake` message is received.
library-compatible `Handshake` message is received.
If a `Handshake` message specifies a Feedme version not supported by the
library, then a `handshake` event is not emitted and the client is sent a
`HandshakeResponse` message indicating failure.
If the client transmits a valid `Handshake` message specifying a Feedme version
not supported by the library, then the client is sent a `HandshakeResponse`
message indicating failure and a `handshake` event is not emitted .
Arguments passed to the listeners:
1. `hreq` (Object) is a `HandshakeRequest` object describing the client request.
2. `hres` (Object) is a `HandshakeResponse` object enabling the application to
respond to the request.
#### action

@@ -282,6 +270,2 @@

If there is no listener attached to the `action` event, then the server
immediately returns an `ActionResponse` message indicating failure (error code
`"INTERNAL_ERROR"`) when a valid `Action` message is received.
Arguments passed to the listeners:

@@ -294,2 +278,6 @@

If there is no listener attached to the `action` event, then the server
immediately returns an `ActionResponse` message indicating failure when a valid
`Action` message is received (error code `"INTERNAL_ERROR"`).
#### feedOpen

@@ -299,6 +287,2 @@

If there is no listener attached to the `feedOpen` event, then the server
immediately returns a `FeedOpenResponse` message indicating failure (error code
`"INTERNAL_ERROR"`) when a valid `FeedOpen` message is received.
Arguments passed to the listeners:

@@ -311,2 +295,6 @@

If there is no listener attached to the `feedOpen` event, then the server
immediately returns a `FeedOpenResponse` message indicating failure when a valid
`FeedOpen` message is received (error code `"INTERNAL_ERROR"`).
#### feedClose

@@ -316,2 +304,10 @@

Arguments passed to the listeners:
1. `fcreq` (Object) is a `FeedCloseRequest` object describing the client
request.
2. `fcres` (Object) is a `FeedCloseResponse` object enabling the application to
respond to the request.
If there is a listener attached to the `feedClose` event, then the application

@@ -331,10 +327,2 @@ must call `fcres.success()` to return a `FeedCloseResponse` message to the

Arguments passed to the listeners:
1. `fcreq` (Object) is a `FeedCloseRequest` object describing the client
request.
2. `fcres` (Object) is a `FeedCloseResponse` object enabling the application to
respond to the request.
#### disconnect

@@ -357,4 +345,4 @@

The client did not transmit a valid and library-compatible `Handshake` message
within the windows specified by `options.handshakeMs`.
The client did not transmit a library-compatible `Handshake` message within
the window specified by `options.handshakeMs`.

@@ -373,3 +361,3 @@ - `err.message === "FAILURE: ..."`

Emitted when a client violates the Feedme specification. The server transmits a
`ViolationResponse` message to the client before this event is emitted.
`ViolationResponse` message to the client before the event is emitted.

@@ -425,9 +413,2 @@ Arguments passed to the listeners:

---
Note that most of these methods can throw TRANSPORT_ERROR from the wrapper,
which may come with transportError property
---
#### server.state()

@@ -438,4 +419,8 @@

Errors thrown: None
Errors thrown:
- `err.message === "TRANSPORT_ERROR: ..."`
The transport behaved unexpectedly.
#### server.start()

@@ -456,2 +441,6 @@

- `err.message === "TRANSPORT_ERROR: ..."`
The transport behaved unexpectedly.
#### server.stop()

@@ -468,2 +457,6 @@

- `err.message === "TRANSPORT_ERROR: ..."`
The transport behaved unexpectedly.
#### server.actionRevelation(params)

@@ -474,8 +467,10 @@

The `params` (Object) argument must contain the following members:
If no client have opened the specified feed then the function returns
successfully.
The `params` (Object) argument contains the following members:
- `params.actionName` (string) The name of the action being revealed.
- `params.actionData` (Object) The action data for the action being revealed.
Must be JSON-expressible.

@@ -488,7 +483,5 @@ - `params.feedName` (string) The name of the feed being revealed on.

- `params.feedDeltas` (Array) An array of spec-compliant delta objects
describing any changes to the feed data that resulted from the action. Note
that the library does _not_ verify that the specified deltas can validly be
applied against the current state of the feed data -- it is up to the
application to ensure validity. Must be JSON-expressible. If a delta specifies
a non-JSON-expressible value then an `INVALID_ARGUMENT: ...` error is thrown.
describing any changes to the feed data that resulted from the action. It is
up to the application to ensure that deltas are valid given the current state
of the feed data.

@@ -502,8 +495,6 @@ - `params.feedMd5` (optional string) A spec-compliant hash of the feed data with

deltas applied. The library will generate a spec-compliant hash of the feed
data and distribute it with the action revelation. The library does not check
whether previously-passed feed data, with deltas applied, is consistent with
the feed data specified here. It is up to the application to ensure validity.
If this parameter is present, then `params.feedMd5` must not be present; if
neither parameter is present, then clients will not be sent a hash for feed
data integrity verification.
data and distribute it with the action revelation. If this parameter is
present, then `params.feedMd5` must not be present; if neither parameter is
present, then clients will not be sent a hash for feed data integrity
verification.

@@ -520,2 +511,6 @@ Errors thrown:

- `err.message === "TRANSPORT_ERROR: ..."`
The transport behaved unexpectedly.
#### server.feedTermination(params)

@@ -529,5 +524,2 @@

If there are no relevant feeds to be closed, including because the client state
is not `ready`, then the function returns successfully.
Behavior depends on the state of the client feed(s) being terminated:

@@ -537,20 +529,19 @@

a `feedOpen` event referencing the feed but the application has not yet called
`feedOpenResponse.success()` or `feedOpenResponse.failure()`), the client is
sent a `FeedOpenResponse` message indicating failure. The error code and data
`fores.success()` or `fores.failure()`), then the client is immediately sent a
`FeedOpenResponse` message indicating failure. The error code and data
transmitted with the message are determined by the parameters passed to this
method. No further action is taken when the application subsequently calls
`feedOpenResponse.success()` or `feedOpenResponse.failure()` but either call
will return successfully.
method. No further action is taken if the application subsequently calls
`fores.success()` or `fores.failure()` and either call will return
successfully.
- When terminating a client feed that is `open`, the client is immediately sent
a `FeedTermination` message. The library will return success to any subsequent
`FeedClose` message as configured by `options.terminationMs` and will not emit
a `feedClose` event.
- When terminating a client feed that is `open`, then the client is immediately
sent a `FeedTermination` message. The library will open a feed termination
window as configured by `options.terminationMs`.
- When terminating a client feed that is `closing` (i.e. the library has stopped
revealing actions on the client feed and has emitted a `feedClose` event but
the application has not yet called `feedCloseResponse.success()`), then the
client is immediately sent a `FeedCloseResponse` indicating success. No
further action is taken when the application calls
`feedOpenResponse.success()` but the call will return successfully.
the application has not yet called `fcres.success()`), then the client is
immediately sent a `FeedCloseResponse` message indicating success. No further
action is taken if the application subsequently calls `fcres.success()` and
the call will return successfully.

@@ -574,4 +565,3 @@ - When terminating a client feed that is already `closed`, nothing is sent to

- `params.errorData` (Object) The error data to return to the client. Must be
JSON-expressible.
- `params.errorData` (Object) The error data to return to the client.

@@ -587,4 +577,3 @@ 2. Terminating all feeds for a specified client

- `params.errorData` (Object) The error data to return to the client. Must be
JSON-expressible.
- `params.errorData` (Object) The error data to return to the client.

@@ -603,4 +592,3 @@ 3. Terminating all clients on a specified feed

- `params.errorData` (Object) The error data to return to the clients. Must be
JSON-expressible.
- `params.errorData` (Object) The error data to return to the clients.

@@ -617,2 +605,6 @@ Errors thrown (for all three usages):

- `err.message === "TRANSPORT_ERROR: ..."`
The transport behaved unexpectedly.
#### server.disconnect(clientId)

@@ -622,4 +614,3 @@

The method returns successfully irrespective of the specified client's current
actual connection state.
The method returns successfully irrespective of the client connection state.

@@ -640,17 +631,13 @@ Arguments:

- `err.message === "TRANSPORT_ERROR: ..."`
The transport behaved unexpectedly.
### Objects
Applications interact with clients using the following types of objects.
Applications respond to client messages using the following types of objects.
Put in each section: When the server transitions to `stopping`, any outstanding
`HandshakeResponse`, `ActionResponse`, `FeedOpenResponse`, and
`FeedCloseResponse` objects are neutralized. Their `success()` and `failure()`
methods will run successfully but will do nothing. If the server had previously
emitted `handshake`, `action`, `feedOpen`, or `feedClose` events associated with
the client, then the response objects passed with those events are neutralized
that `success()` and `failure()` calls succeed but do nothing.
#### Handshake Objects
When the `handshake` event is fired, listeners receive two parameters: a
When the `handshake` event is fired, listeners are passed two arguments: a
`HandshakeRequest` object and a `HandshakeResponse` object.

@@ -660,13 +647,12 @@

`HandshakeRequest` objects have the following properties:
`HandshakeRequest` objects (`hreq`) have the following properties:
- `handshakeRequest.clientId` (string) is the Feedme client identifier that the
library has assigned to the client. The identifier is shared with the client,
as per the Feedme specification.
- `hreq.clientId` (string) is the identifier that the library has assigned to
the client. The identifier is shared with the client.
##### HandshakeResponse
`HandshakeResponse` objects have the following methods:
`HandshakeResponse` objects (`hres`) have the following methods:
- `handshakeResponse.success()`
- `hres.success()`

@@ -677,2 +663,5 @@ Returns a `HandshakeResponse` message to the client indicating success. The

If the client has disconnected or the server has stopped, then the method will
do nothing but will return successfully.
Errors thrown:

@@ -682,7 +671,7 @@

There has already been a call to `handshakeResponse.success()`.
There has already been a call to `hres.success()`.
#### Action Objects
When the `action` event is fired, listeners receive two parameters: an
When the `action` event is fired, listeners are passed two arguments: an
`ActionRequest` object and an `ActionResponse` object.

@@ -692,16 +681,16 @@

`ActionRequest` objects have the following properties:
`ActionRequest` objects (`areq`) have the following properties:
- `actionRequest.clientId` (string) is the Feedme client identifier that the
library has assigned to the client.
- `areq.clientId` (string) is the identifier that the library assigned to the
client.
- `actionRequest.actionName` (string) is the name of the action being invoked.
- `areq.actionName` (string) is the name of the action being invoked.
- `actionRequest.actionArgs` (object) contains arguments for the invokation.
- `areq.actionArgs` (Object) contains arguments for the invocation.
##### ActionResponse
`ActionResponse` objects have the following methods:
`ActionResponse` objects (`ares`) have the following methods:
- `actionResponse.success(actionData)`
- `ares.success(actionData)`

@@ -715,4 +704,4 @@ Returns an `ActionResponse` message to the client indicating success.

1. `actionData` (object) is the action data, which is transmitted to the
client. Must be JSON-expressible.
1. `actionData` (Object) is the action data, which is transmitted to the
client.

@@ -727,6 +716,5 @@ Errors thrown:

There has already been a call to `actionResponse.success()` or
`actionResponse.failure()`.
There has already been a call to `ares.success()` or `ares.failure()`.
- `actionResponse.failure(errorCode, errorData)`
- `ares.failure(errorCode, errorData)`

@@ -743,3 +731,3 @@ Returns an `ActionResponse` message to the client indicating failure.

2. `errorData` (optional Object) may provide additional details, which are
transmitted to the client. Must be JSON-expressible.
transmitted to the client.

@@ -754,8 +742,7 @@ Errors thrown:

There has already been a call to `actionResponse.success()` or
`actionResponse.failure()`.
There has already been a call to `ares.success()` or `ares.failure()`.
#### FeedOpen Objects
When the `feedOpen` event is fired, listeners receive two parameters: a
When the `feedOpen` event is fired, listeners are passed two arguments: a
`FeedOpenRequest` object and a `FeedOpenResponse` object.

@@ -765,17 +752,17 @@

`FeedOpenRequest` objects have the following properties:
`FeedOpenRequest` objects (`foreq`) have the following properties:
- `feedOpenRequest.clientId` (string) is the Feedme client identifier that the
library has assigned to the client.
- `foreq.clientId` (string) is the identifier that the library assigned to the
client.
- `feedOpenRequest.feedName` (string) is the name of the feed being opened.
- `foreq.feedName` (string) is the name of the feed being opened.
- `feedOpenRequest.feedArgs` (object of strings) contains arguments for for the
feed being opened.
- `foreq.feedArgs` (Object of strings) contains arguments for the feed being
opened.
##### FeedOpenResponse
`FeedOpenResponse` objects have the following methods:
`FeedOpenResponse` objects (`fores`) have the following methods:
- `feedOpenResponse.success(feedData)`
- `fores.success(feedData)`

@@ -790,4 +777,3 @@ Returns a `FeedOpenResponse` message to the client indicating success.

1. `feedData` (object) specifies the initial state of the feed data. Must be
JSON-expressible.
1. `feedData` (Object) specifies the initial state of the feed data.

@@ -802,6 +788,5 @@ Errors thrown:

There has already been a call to `feedOpenResponse.success()` or
`feedOpenResponse.failure()`.
There has already been a call to `fores.success()` or `fores.failure()`.
- `feedOpenResponse.failure(errorCode, errorData)`
- `fores.failure(errorCode, errorData)`

@@ -819,3 +804,3 @@ Returns a `FeedOpenResponse` message to the client indicating failure.

2. `errorData` (optional Object) may provide additional details, which are
transmitted to the client. Must be JSON-expressible.
transmitted to the client.

@@ -830,8 +815,7 @@ Errors thrown:

There has already been a call to `feedOpenResponse.success()` or
`feedOpenResponse.failure()`.
There has already been a call to `fores.success()` or `fores.failure()`.
#### FeedClose Objects
When the `feedClose` event is fired, listeners receive two parameters: a
When the `feedClose` event is fired, listeners are passed two arguments: a
`FeedCloseRequest` object and a `FeedCloseResponse` object.

@@ -841,17 +825,17 @@

`FeedCloseRequest` objects have the following properties:
`FeedCloseRequest` objects (`fcreq`) have the following properties:
- `feedCloseRequest.clientId` (string) is the Feedme client identifier that the
library has assigned to the client.
- `fcreq.clientId` (string) is the identifier that the library assigned to the
client.
- `feedCloseRequest.feedName` (string) is the name of the feed being closed.
- `fcreq.feedName` (string) is the name of the feed being closed.
- `feedCloseRequest.feedArgs` (object of strings) contains arguments for for the
feed being closed.
- `fcreq.feedArgs` (Object of strings) contains arguments for the feed being
closed.
##### FeedCloseResponse
`FeedCloseResponse` objects have the following methods:
`FeedCloseResponse` objects (`fcres`) have the following methods:
- `feedCloseResponse.success()`
- `fcres.success()`

@@ -867,2 +851,2 @@ Returns a `FeedCloseResponse` message to the client indicating success.

There has already been a call to `feedCloseResponse.success()`.
There has already been a call to `fcres.success()`.

@@ -145,3 +145,3 @@ "use strict";

* Added when a client connects to the transport - pre-specified
* Feedme clientid not yet be communicated to the client by a HandshakeResponse
* Feedme client id may not yet have been communicated to the client by a HandshakeResponse
*

@@ -167,3 +167,3 @@ * Removed when

* Added when a client connects via the transport - pre-specified
* Feedme clientid not yet be communicated to the client by a HandshakeResponse
* Feedme client id may not yet have been communicated to the client by a HandshakeResponse
*

@@ -238,6 +238,6 @@ * Removed when

*
* Added when a client connects to the transport (if configured)
* Added when a client connects to the transport (if so configured)
*
* Removed when
* The client submits a version-compatible Handshake message
* The client submits a library-compatible Handshake message
* The client disconnects from the transport

@@ -282,3 +282,3 @@ * The server stops

* A FeedCloseResponse is message sent
* A FeedTermination message is sent (after terminationMs passes, if configured)
* A FeedTermination message is sent (after terminationMs passes, if so configured)
* The client disconnects from the transport

@@ -303,3 +303,3 @@ * The server stops

* A FeedCloseResponse message is sent
* A FeedTermination message is sent (after) terminationMs passes, if configured)
* A FeedTermination message is sent (after terminationMs passes, if so configured)
* The client disconnects from the transport

@@ -317,3 +317,3 @@ * The server stops

* Active FeedOpenResponse objects that have been emitted to the application.
* Always and only exists when feed state is opening.
* Always and only exist when feed state is opening.
*

@@ -340,3 +340,3 @@ * server._feedOpenResponses[cid][feedSerial] = FeedOpenResponse object

* Active FeedCloseResponse objects that have been emitted to the application.
* Always and only exists when feed state is closing.
* Always and only exist when feed state is closing.
*

@@ -366,3 +366,3 @@ * server._feedCloseResponses[cid][feedSerial] = FeedCloseResponse object

*
* Added when a FeedTermination message is sent (if configured)
* Added when a FeedTermination message is sent (if so configured)
*

@@ -473,3 +473,3 @@ * Removed when

* @param {string} clientId
* @param {?Error} err "HANDSHAKE_TIMEOUT: ..." if client did not handshake
* @param {?Error} err "HANDSHAKE_TIMEOUT: ..." if client did not handshake in time
* "STOPPING: ..." if the due to a call to server.stop()

@@ -1161,3 +1161,3 @@ * "FAILURE: ..." if the transport failed

} // If a termination timer exists then kill it
// May not exist even if feed state is terminated (if terminationMs is 0)
// May not exist even if the feed state is terminated (if terminationMs is 0)

@@ -1262,3 +1262,3 @@

dbg("Successful FeedClose message"); // If a termination timer exists then kill it
// May not exist even if feed state is terminated (if terminationMs is 0)
// May not exist even if the feed state is terminated (if terminationMs is 0)

@@ -1672,3 +1672,4 @@ if (this._exists(this._terminationTimers, clientId, feedSerial)) {

* Set obj.key1.key2 equal to val and create the obj.key1 object if it
* doesn't exist. If obj.key1 exists, it is assumed to be an object.
* doesn't exist.
* @memberof Server
* @instance

@@ -1693,3 +1694,3 @@ * @private

* Delete obj.key1.key2 and then delete obj.key1 if it is empty.
* Assume that obj.key1 and obj.key1.key2 exist.
* @memberof Server
* @instance

@@ -1713,3 +1714,3 @@ * @private

* Return obj.key1.key2 if it exists, otherwise return specified value.
* Assume that obj.key1 is an object if present.
* @memberof Server
* @instance

@@ -1734,3 +1735,3 @@ * @private

* Return true if obj.key1.key2 exists and false if either key does not.
* Assume that obj.key1 is an object if present.
* @memberof Server
* @instance

@@ -1737,0 +1738,0 @@ * @private

@@ -27,4 +27,2 @@ "use strict";

*
* After initialization, any problems with the transport are reported using
* the `transportError` event.
* @typedef {Object} TransportWrapper

@@ -31,0 +29,0 @@ * @extends emitter

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc