Socket
Socket
Sign inDemoInstall

pusher-js

Package Overview
Dependencies
8
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.3.0 to 4.3.1

6

CHANGELOG.md
# Changelog
## 4.3.0 (2018-08-13)
## 4.3.1 (2018-09-03)
[FIXED] Honour protocol error codes received after connection succeeds
## 4.3.0 (2018-08-13)
[NEW] This release adds support for end to end encrypted channels, a new feature for Channels. Read more [in our docs](https://pusher.com/docs/client_api_guide/client_encrypted_channels).

@@ -6,0 +10,0 @@

2

package.json
{
"name": "pusher-js",
"version": "4.3.0",
"version": "4.3.1",
"description": "Pusher JavaScript library for browsers, React Native, NodeJS and web workers",

@@ -5,0 +5,0 @@ "main": "dist/node/pusher.js",

@@ -456,2 +456,49 @@ var ConnectionManager = require('core/connection/connection_manager').default;

});
describe("on error callback", function() {
var errorHandler;
beforeEach(function() {
errorHandler = jasmine.createSpy();
manager.bind("error", errorHandler)
});
it("should emit error and disconnect upon receipt of a refused event", function() {
var error = {code: 4000};
connection.emit("refused", {error: error});
expect(manager.state).toEqual("disconnected");
expect(errorHandler).toHaveBeenCalledWith({
type: 'WebSocketError',
error: error
});
});
it("should emit error and reconnect upon receipt of a tls_only event", function() {
var error = {code: 4000};
connection.emit("tls_only", {error: error});
jasmine.Clock.tick(1);
expect(manager.state).toEqual("connecting");
expect(errorHandler).toHaveBeenCalledWith({
type: 'WebSocketError',
error: error
});
});
it("should emit error and reconnect with backoff upon receipt of a backoff event", function() {
var error = {code: 4100};
connection.emit("backoff", {error: error});
jasmine.Clock.tick(1000);
expect(manager.state).toEqual("connecting");
expect(errorHandler).toHaveBeenCalledWith({
type: 'WebSocketError',
error: error
});
});
it("should emit error and reconnect upon receipt of a retry event", function() {
var error = {code: 4200};
connection.emit("retry", {error: error});
jasmine.Clock.tick(1);
expect(manager.state).toEqual("connecting");
expect(errorHandler).toHaveBeenCalledWith({
type: 'WebSocketError',
error: error
});
});
});
});

@@ -458,0 +505,0 @@

import HandshakePayload from './handshake/handshake_payload';
import Action from './protocol/action';
export interface ErrorCallbacks {
tls_only: (result: HandshakePayload) => void;
refused: (result: HandshakePayload) => void;
backoff: (result: HandshakePayload) => void;
retry: (result: HandshakePayload) => void;
tls_only: (result: Action | HandshakePayload) => void;
refused: (result: Action | HandshakePayload) => void;
backoff: (result: Action | HandshakePayload) => void;
retry: (result: Action | HandshakePayload) => void;
}

@@ -9,0 +10,0 @@

@@ -13,2 +13,3 @@ import {default as EventsDispatcher} from '../events/dispatcher';

import {ErrorCallbacks, HandshakeCallbacks, ConnectionCallbacks} from './callbacks';
import Action from './protocol/action';

@@ -68,4 +69,4 @@ /** Manages connection to Pusher.

this.connectionCallbacks = this.buildConnectionCallbacks();
this.errorCallbacks = this.buildErrorCallbacks();
this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks);
this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);

@@ -250,4 +251,4 @@

private buildConnectionCallbacks() : ConnectionCallbacks {
return {
private buildConnectionCallbacks(errorCallbacks: ErrorCallbacks) : ConnectionCallbacks {
return Collections.extend<ConnectionCallbacks>({}, errorCallbacks, {
message: (message)=> {

@@ -274,3 +275,3 @@ // includes pong messages from server

}
};
});
};

@@ -296,3 +297,3 @@

let withErrorEmitted = (callback)=> {
return (result)=> {
return (result: Action | HandshakePayload)=> {
if (result.error) {

@@ -299,0 +300,0 @@ this.emit("error", { type: "WebSocketError", error: result.error });

@@ -154,5 +154,5 @@ import * as Collections from '../utils/collections';

if (action) {
this.emit(action);
this.emit(action, {action: action, error: error});
}
}
}

@@ -5,10 +5,7 @@ import TransportConnection from "../../transports/transport_connection";

interface HandshakePayload {
interface HandshakePayload extends Action {
transport: TransportConnection;
action: Action;
connection?: Connection;
activityTimeout?: number;
error: any;
}
export default HandshakePayload;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc