Skip to content

Commit 60e0750

Browse files
amarzaverygrs
authored andcommitted
Added sender_flow and receiver_flow events based on this issue comment #74 (comment)
1 parent c11121c commit 60e0750

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

lib/eventTypes.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ var ReceiverEvents;
3232
* are no more messages at present that it can send).
3333
*/
3434
ReceiverEvents['receiverDrained'] = 'receiver_drained';
35+
/**
36+
* @property {string} receiverFlow Raised when a flow is received for receiver.
37+
*/
38+
ReceiverEvents['receiverFlow'] = 'receiver_flow';
3539
/**
3640
* @property {string} receiverError Raised when the remote peer
3741
* closes the receiver with an error. The context may also have an
@@ -68,6 +72,10 @@ var SenderEvents;
6872
* is used up..
6973
*/
7074
SenderEvents['senderDraining'] = 'sender_draining';
75+
/**
76+
* @property {string} senderFlow Raised when a flow is received for sender.
77+
*/
78+
SenderEvents['senderFlow'] = 'sender_flow';
7179
/**
7280
* @property {string} senderError Raised when the remote peer
7381
* closes the sender with an error. The context may also have an
@@ -139,6 +147,14 @@ var ConnectionEvents;
139147
* the connection.
140148
*/
141149
ConnectionEvents['connectionError'] = 'connection_error';
150+
/**
151+
* @property {string} protocolError Raised when a protocol error is received on the underlying socket.
152+
*/
153+
ConnectionEvents['protocolError'] = 'protocol_error',
154+
/**
155+
* @property {string} error Raised when an error is received on the underlying socket.
156+
*/
157+
ConnectionEvents['error'] = 'error',
142158
/**
143159
* @property {string} disconnected Raised when the underlying tcp connection is lost. The context
144160
* has a reconnecting property which is true if the library is attempting to automatically reconnect

test/eventTypes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe('event types', function() {
2222
assert.equal(rhea.ReceiverEvents.message, "message");
2323
assert.equal(rhea.ReceiverEvents.receiverClose, "receiver_close");
2424
assert.equal(rhea.ReceiverEvents.receiverDrained, "receiver_drained");
25+
assert.equal(rhea.ReceiverEvents.receiverFlow, "receiver_flow");
2526
assert.equal(rhea.ReceiverEvents.receiverError, "receiver_error");
2627
assert.equal(rhea.ReceiverEvents.receiverOpen, "receiver_open");
2728
assert.equal(rhea.ReceiverEvents.settled, "settled");
@@ -33,6 +34,7 @@ describe('event types', function() {
3334
assert.equal(rhea.SenderEvents.released, "released");
3435
assert.equal(rhea.SenderEvents.modified, "modified");
3536
assert.equal(rhea.SenderEvents.senderDraining, "sender_draining");
37+
assert.equal(rhea.SenderEvents.senderFlow, "sender_flow");
3638
assert.equal(rhea.SenderEvents.sendable, "sendable");
3739
assert.equal(rhea.SenderEvents.senderClose, "sender_close");
3840
assert.equal(rhea.SenderEvents.senderError, "sender_error");
@@ -52,6 +54,8 @@ describe('event types', function() {
5254
assert.equal(rhea.ConnectionEvents.connectionClose, "connection_close");
5355
assert.equal(rhea.ConnectionEvents.connectionError, "connection_error");
5456
assert.equal(rhea.ConnectionEvents.connectionOpen, "connection_open");
57+
assert.equal(rhea.ConnectionEvents.protocolError, "protocol_error");
58+
assert.equal(rhea.ConnectionEvents.error, "error");
5559
assert.equal(rhea.ConnectionEvents.disconnected, "disconnected");
5660
assert.equal(rhea.ConnectionEvents.settled, "settled");
5761
done();

typings/connection.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,14 @@ export declare enum ConnectionEvents {
570570
* the connection.
571571
*/
572572
connectionError = "connection_error",
573+
/**
574+
* @property {string} protocolError Raised when a protocol error is received on the underlying socket.
575+
*/
576+
protocolError = "protocol_error",
577+
/**
578+
* @property {string} error Raised when an error is received on the underlying socket.
579+
*/
580+
error = "error",
573581
/**
574582
* @property {string} disconnected Raised when the underlying tcp connection is lost. The context
575583
* has a reconnecting property which is true if the library is attempting to automatically reconnect

typings/link.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ export declare enum ReceiverEvents {
9090
* are no more messages at present that it can send).
9191
*/
9292
receiverDrained = 'receiver_drained',
93+
/**
94+
* @property {string} receiverFlow Raised when a flow is received for receiver.
95+
*/
96+
receiverFlow = "receiver_flow",
9397
/**
9498
* @property {string} receiverError Raised when the remote peer closes the receiver with an
9599
* error. The context may also have an error property giving some information about the reason
@@ -124,6 +128,10 @@ export declare enum SenderEvents {
124128
* is used up..
125129
*/
126130
senderDraining = 'sender_draining',
131+
/**
132+
* @property {string} senderFlow Raised when a flow is received for sender.
133+
*/
134+
senderFlow = "sender_flow",
127135
/**
128136
* @property {string} senderError Raised when the remote peer closes the sender with an
129137
* error. The context may also have an error property giving some information about the

0 commit comments

Comments
 (0)