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

centrifuge

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

centrifuge - npm Package Compare versions

Comparing version 2.7.1 to 2.7.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

2.7.2
=====
* Handle server-side SUB push in Protobuf case (previously ignored). Sub push is a message that contains information about server-side subscription made after connection already established.
2.7.1

@@ -2,0 +7,0 @@ =====

2

package.json
{
"name": "centrifuge",
"version": "2.7.1",
"version": "2.7.2",
"description": "Centrifuge and Centrifugo client for NodeJS and browser",

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

@@ -987,2 +987,27 @@ # Centrifuge client for NodeJS and browser

### Custom WebSocket constructor
If you are building a client for a non-browser environment and want to pass custom headers then you can use the following approach to wrap a WebSocket constructor and let custom options to be used on connection initialization:
```javascript
var Centrifuge = require("centrifuge");
const WebSocket = require('ws');
const myWs = function (options) {
return class wsClass extends WebSocket {
constructor(...args) {
super(...[...args, ...[options]])
}
}
}
```
It should be now possible to use pass your custom WebSocket constructor to `centrifuge-js` and so custom headers will be used when connecting to a server:
```javascript
var centrifuge = new Centrifuge('ws://localhost:8000/connection/websocket', {
websocket: myWs({ headers: { Authorization: '<token or key>' } }),
});
```
## Feature matrix

@@ -993,3 +1018,3 @@

- [x] connect with token (JWT)
- [ ] connect with custom header (not supported by browser API)
- [ ] connect with custom header (not supported by browser API, though [possible for a non-browser target env](https://github.com/centrifugal/centrifuge-js#custom-websocket-constructor))
- [x] automatic reconnect in case of errors, network problems etc

@@ -996,0 +1021,0 @@ - [x] an exponential backoff for reconnect

@@ -79,3 +79,4 @@ import {Centrifuge} from './centrifuge.js';

UNSUB: proto.lookupEnum('PushType').values.UNSUB,
MESSAGE: proto.lookupEnum('PushType').values.MESSAGE
MESSAGE: proto.lookupEnum('PushType').values.MESSAGE,
SUB: proto.lookupEnum('PushType').values.SUB
};

@@ -82,0 +83,0 @@

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

Sorry, the diff of this file is not supported yet

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

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