@feathersjs/transport-commons
Advanced tools
Comparing version 3.2.0 to 4.0.0
# Change Log | ||
## [v3.2.0](https://github.com/feathersjs/transport-commons/tree/v3.2.0) (2018-01-30) | ||
[Full Changelog](https://github.com/feathersjs/transport-commons/compare/v3.1.5...v3.2.0) | ||
**Closed issues:** | ||
- Publishing to a channel fails after passing safety check [\#66](https://github.com/feathersjs/transport-commons/issues/66) | ||
- Feathers Server Ends unexpected if some arg to socket.io is a ipv6 local subnet [\#65](https://github.com/feathersjs/transport-commons/issues/65) | ||
**Merged pull requests:** | ||
- Rename to @feathersjs/transport-commons [\#69](https://github.com/feathersjs/transport-commons/pull/69) ([daffl](https://github.com/daffl)) | ||
- Switch to Radix tree based routing [\#68](https://github.com/feathersjs/transport-commons/pull/68) ([daffl](https://github.com/daffl)) | ||
- Update mocha to the latest version 🚀 [\#64](https://github.com/feathersjs/transport-commons/pull/64) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
- Update semistandard to the latest version 🚀 [\#63](https://github.com/feathersjs/transport-commons/pull/63) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
## [v3.1.5](https://github.com/feathersjs/transport-commons/tree/v3.1.5) (2017-12-12) | ||
@@ -67,3 +82,3 @@ [Full Changelog](https://github.com/feathersjs/transport-commons/compare/v3.1.4...v3.1.5) | ||
- feathers-transport-commons produces error when it get bundled and steal-socket.io gets used as connection [\#44](https://github.com/feathersjs/transport-commons/issues/44) | ||
- feathers-socket-commons produces error when it get bundled and steal-socket.io gets used as connection [\#44](https://github.com/feathersjs/transport-commons/issues/44) | ||
- Surface src/events.js lines 44-69 for feathers-hooks-common/src/filters/combine.js [\#40](https://github.com/feathersjs/transport-commons/issues/40) | ||
@@ -70,0 +85,0 @@ |
@@ -1,2 +0,2 @@ | ||
const { convert } = require('@feathersjs/errors'); | ||
const { convert, Timeout } = require('@feathersjs/errors'); | ||
const debug = require('debug')('@feathersjs/transport-commons/client'); | ||
@@ -66,3 +66,7 @@ | ||
const timeoutId = setTimeout(() => reject( | ||
new Error(`Timeout of ${this.timeout}ms exceeded calling ${method} on ${this.path}`) | ||
new Timeout(`Timeout of ${this.timeout}ms exceeded calling ${method} on ${this.path}`, { | ||
timeout: this.timeout, | ||
method, | ||
path: this.path | ||
}) | ||
), this.timeout); | ||
@@ -69,0 +73,0 @@ |
@@ -1,48 +0,5 @@ | ||
const debug = require('debug')('@feathersjs/transport-commons'); | ||
const socket = require('./socket'); | ||
const routing = require('./routing'); | ||
const channels = require('./channels'); | ||
const routing = require('./routing'); | ||
const { getDispatcher, runMethod } = require('./utils'); | ||
module.exports = function ({ done, emit, socketKey, getParams }) { | ||
return app => { | ||
app.configure(channels()); | ||
app.configure(routing()); | ||
app.on('publish', getDispatcher(emit, socketKey)); | ||
// `connection` event | ||
done.then(provider => provider.on('connection', socket => | ||
app.emit('connection', getParams(socket))) | ||
); | ||
// `socket.emit('methodName', 'serviceName', ...args)` handlers | ||
done.then(provider => provider.on('connection', socket => { | ||
for (let method of app.methods) { | ||
socket.on(method, (...args) => { | ||
const path = args.shift(); | ||
debug(`Got '${method}' call for service '${path}'`); | ||
runMethod(app, getParams(socket), path, method, args); | ||
}); | ||
} | ||
})); | ||
// Legacy `socket.emit('serviceName::methodName', ...args)` handlers | ||
app.mixins.push((service, path) => done.then(provider => { | ||
provider.on('connection', socket => { | ||
const methods = app.methods.filter(current => | ||
typeof service[current] === 'function' | ||
); | ||
for (let method of methods) { | ||
const eventName = `${path}::${method}`; | ||
socket.on(eventName, (...args) => { | ||
debug(`Got legacy method call '${eventName}'`); | ||
runMethod(app, getParams(socket), path, method, args); | ||
}); | ||
} | ||
}); | ||
})); | ||
}; | ||
}; | ||
module.exports = { socket, routing, channels }; |
@@ -7,2 +7,6 @@ const Router = require('radix-router'); | ||
return app => { | ||
if (typeof app.lookup === 'function') { | ||
return; | ||
} | ||
const router = new Router(); | ||
@@ -9,0 +13,0 @@ |
{ | ||
"name": "@feathersjs/transport-commons", | ||
"description": "Shared functionality for websocket providers", | ||
"version": "3.2.0", | ||
"version": "4.0.0", | ||
"homepage": "https://github.com/feathersjs/transport-commons", | ||
@@ -6,0 +6,0 @@ "main": "lib/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37613
15
442