Socket
Socket
Sign inDemoInstall

@feathersjs/socketio

Package Overview
Dependencies
33
Maintainers
4
Versions
121
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-pre.9 to 5.0.0-pre.10

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
**Note:** Version bump only for package @feathersjs/socketio
# [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)

@@ -8,0 +16,0 @@

69

lib/index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -19,3 +10,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

const middleware_1 = require("./middleware");
const debug = commons_1.createDebug('@feathersjs/socketio');
const debug = (0, commons_1.createDebug)('@feathersjs/socketio');
function configureSocketio(port, options, config) {

@@ -41,37 +32,33 @@ if (typeof port !== 'number') {

Object.assign(app, {
listen(...args) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof listen === 'function') {
// If `listen` already exists
// usually the case when the app has been expressified
return listen.call(this, ...args);
}
const server = http_1.default.createServer();
yield this.setup(server);
return server.listen(...args);
});
async listen(...args) {
if (typeof listen === 'function') {
// If `listen` already exists
// usually the case when the app has been expressified
return listen.call(this, ...args);
}
const server = http_1.default.createServer();
await this.setup(server);
return server.listen(...args);
},
setup(server, ...rest) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.io) {
const io = this.io = new socket_io_1.Server(port || server, options);
io.use(middleware_1.disconnect(app, getParams));
io.use(middleware_1.params(app, socketMap));
io.use(middleware_1.authentication(app, getParams));
// In Feathers it is easy to hit the standard Node warning limit
// of event listeners (e.g. by registering 10 services).
// So we set it to a higher number. 64 should be enough for everyone.
io.sockets.setMaxListeners(64);
}
if (typeof config === 'function') {
debug('Calling SocketIO configuration function');
config.call(this, this.io);
}
resolve(this.io);
return setup.call(this, server, ...rest);
});
async setup(server, ...rest) {
if (!this.io) {
const io = this.io = new socket_io_1.Server(port || server, options);
io.use((0, middleware_1.disconnect)(app, getParams));
io.use((0, middleware_1.params)(app, socketMap));
io.use((0, middleware_1.authentication)(app, getParams));
// In Feathers it is easy to hit the standard Node warning limit
// of event listeners (e.g. by registering 10 services).
// So we set it to a higher number. 64 should be enough for everyone.
io.sockets.setMaxListeners(64);
}
if (typeof config === 'function') {
debug('Calling SocketIO configuration function');
config.call(this, this.io);
}
resolve(this.io);
return setup.call(this, server, ...rest);
}
});
});
app.configure(transport_commons_1.socket({
app.configure((0, transport_commons_1.socket)({
done,

@@ -78,0 +65,0 @@ socketMap,

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.authentication = exports.params = exports.disconnect = void 0;
const commons_1 = require("@feathersjs/commons");
const debug = commons_1.createDebug('@feathersjs/socketio/middleware');
const debug = (0, commons_1.createDebug)('@feathersjs/socketio/middleware');
const disconnect = (app, getParams) => (socket, next) => {

@@ -40,7 +31,7 @@ socket.once('disconnect', () => app.emit('disconnect', getParams(socket)));

service.parse(socket.handshake, null, ...authStrategies)
.then((authentication) => __awaiter(void 0, void 0, void 0, function* () {
.then(async (authentication) => {
if (authentication) {
debug('Parsed authentication from HTTP header', authentication);
socket.feathers.authentication = authentication;
yield service.create(authentication, {
await service.create(authentication, {
provider: 'socketio',

@@ -51,5 +42,5 @@ connection: getParams(socket)

next();
})).catch(next);
}).catch(next);
};
exports.authentication = authentication;
//# sourceMappingURL=middleware.js.map
{
"name": "@feathersjs/socketio",
"description": "The Feathers Socket.io real-time API provider",
"version": "5.0.0-pre.9",
"version": "5.0.0-pre.10",
"homepage": "https://feathersjs.com",

@@ -53,21 +53,21 @@ "main": "lib/",

"dependencies": {
"@feathersjs/commons": "^5.0.0-pre.9",
"@feathersjs/transport-commons": "^5.0.0-pre.9",
"socket.io": "^4.1.3"
"@feathersjs/commons": "^5.0.0-pre.10",
"@feathersjs/transport-commons": "^5.0.0-pre.10",
"socket.io": "^4.2.0"
},
"devDependencies": {
"@feathersjs/commons": "^5.0.0-pre.2",
"@feathersjs/express": "^5.0.0-pre.9",
"@feathersjs/feathers": "^5.0.0-pre.9",
"@feathersjs/memory": "^5.0.0-pre.9",
"@feathersjs/tests": "^5.0.0-pre.9",
"@feathersjs/express": "^5.0.0-pre.10",
"@feathersjs/feathers": "^5.0.0-pre.10",
"@feathersjs/memory": "^5.0.0-pre.10",
"@feathersjs/tests": "^5.0.0-pre.10",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.13",
"@types/node": "^16.9.4",
"lodash": "^4.17.21",
"mocha": "^9.0.3",
"mocha": "^9.1.1",
"shx": "^0.3.3",
"socket.io-client": "^4.1.3",
"typescript": "^4.3.5"
"socket.io-client": "^4.2.0",
"typescript": "^4.4.3"
},
"gitHead": "3d1721a7286e6a7f37bbc38695fe45084023f13b"
"gitHead": "a9f7865cce8db2305b7c0d2ef4a165c2724034ef"
}

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc