Giter Site home page Giter Site logo

socketio's Introduction

@feathersjs/socketio

Important: The code for this module has been moved into the main Feathers repository at feathersjs/feathers (package direct link). Please open issues and pull requests there. No changes in your existing Feathers applications are necessary.

Build Status

The Feathers Socket.io real-time API provider

Installation

npm install @feathersjs/socketio --save

Quick example

const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio');

const app = feathers();

app.configure(socketio());

app.listen(3030);

Documentation

Please refer to the @feathersjs/socketio documentation for more details.

License

Copyright (c) 2018

Licensed under the MIT license.

socketio's People

Contributors

abraaoalves avatar corymsmith avatar daffl avatar ekryski avatar elliotpsyit avatar faianca avatar greenkeeper[bot] avatar greenkeeperio-bot avatar kostia-official avatar larkinscott avatar marshallswain avatar myknbani avatar superbarne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socketio's Issues

Connection closed before receiving a handshake response

i'm also facing problem like you @huytran0605
getting this error :
wss://ws.xxxxxxxx.xx:4038/socket.io/?EIO=3&transport=websocket' failed: Connection closed before receiving a handshake response

this is the code of my front-end in .vue file

import io from 'socket.io-client';
  import feathers from 'feathers/client';
  import socketio from 'feathers-socketio/client';

  var socket = io('wss://ws.xxxxxxxx:4038', { transports: ['websocket']})
  var app = feathers();
  app.configure(socketio(socket));
  var message = app.service('vshopdata');
  Vue.use(feathers);

this is the code of my back-end in app.js file

const express = require('@feathersjs/express');
const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio');

const app = express(feathers());
app.configure(configuration(path.join(__dirname, '..')))

app.configure(socketio(4038, {
  wsEngine: 'uws',
  origin: '*.xxxxxx.xx:*'
}));

Get data after connection established

Hi Guys,

This might be a super dumb question, but here it goes.

As per example provided under this repository, my client is able to connect fine and i do get a response from "socket.emit('news', { hello: 'world' });".

How do i go about CRUD, fetching data from the example provided? is there an example somewhere? I haven't been able to use feathers-client on my app due to some errors under "ionic", i'm using vanilla socket.io syntax (see below)

`this.messages = [];
this.socketHost = "http://localhost:3030";
this.zone = new NgZone({enableLongStackTrace: false});

    this.chatBox = "";
    this.socket.socketService.subscribe(event => {
    console.log('message received from server... ', event);
    if (event.category === 'messages'){
      this.zone.run(() => {
        this.messages.push(event.message);
        this.chat.scrollTo(0, 99999, 0);
      });
    }
  }); //end of subscribe`

Regarding plain websockets

Necessary backstory: I'm creating an ad network where publishers embed my script file into their page. This means I'm unable to import any other files, so I'm reliant on what's already built into javascript.

I'm trying to communicate with my feathersjs socket, but I can only do so with the plain old Websocket()

Ex: var socket = new Websocket('myfeatherssocketurl')

Is this even possible? I noticed in the docs that when emitting something to the socket, you have to include an event name when you send the data, ex: socket.emit('message::create'), but you can't do that with an ordinary socket.

Is it possible to accomplish this with an ordinary socket?

Uncaught (in promise) Error: Timeout of 5000ms exceeded calling sites::find(…)

I'm trying to implement the feathers socketio client into my vuejs/vuex frontend application, but I'm getting a timeout when requesting the data.

The connection to the socket is being made, but i never receive the data, only the timeout. My implementation is almost identical to this one. https://gist.github.com/niallobrien/b03a35cda674f20d74bfc27bc7a0692a

Here is my version: https://gist.github.com/Upguard/e196b3ea016e8234a86342991ce6db24

I used feathers-cli to generate my app with socketio and rest api installed.

Am I doing something wrong? I cant for the life of me figure out why it's timing out, yet if I console.log socket.on('connect', () => console.log(socket.connected)) it returns true. I can look in the console and see all of the functions available, including the socket id, etc.

I should also note that I'm running the feathers api on a cloud9 instance on port 8080 (which I believe is proxied to port 80 by cloud9)

`yarn add @feathersjs/socketio` gets stuck

yarn add @feathersjs/socketio gets stuck

Steps to reproduce

yarn add @feathersjs/socketio

Expected behavior

yarn add @feathersjs/socketio to install @feathersjs/socketio

Actual behavior

➜ yarn add @feathersjs/socketio
yarn add v1.3.2
[1/5] πŸ”  Validating package.json...
[2/5] πŸ”  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] πŸ”—  Linking dependencies...
[5/5] πŸ“ƒ  Building fresh packages...
⠁
[1/2] β ‚ husky
[-/2] ⠈ waiting...
[-/2] β’€ waiting...
[-/2] ⠈ waiting...
[2/2] ⠈ uws
[-/2] ⠁ waiting...
[2/2] ⠁ uws
[-/2] ⠁ waiting...
[-/2] ⠁ waiting...
[4/4] πŸ“ƒ  Building fresh packages...
[-/2] ⠈ waiting...
[2/2] ⠈ uws
[-/2] ⠈ waiting...
[-/2] ⠈ waiting...
[-/2] ⠈ waiting...

System configuration

Tell us about the applicable parts of your setup.

My package.json

{
  "name": "@starter-kit/api",
  "description": "",
  "version": "0.1.0",
  "homepage": "",
  "main": "src",
  "keywords": [
    "feathers"
  ],
  "author": {
    "name": "Aaron Vasquez",
    "email": "[email protected]"
  },
  "contributors": [],
  "bugs": {},
  "directories": {
    "lib": "src",
    "test": "test/"
  },
  "engines": {
    "node": "^9.5.0",
    "yarn": ">= 0.18.0"
  },
  "devDependencies": {
    "babel-eslint": "^8.2.1",
    "eslint": "^4.18.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-config-prettier": "^2.9.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-prettier": "^2.6.0",
    "eslint-plugin-react": "^7.6.1",
    "husky": "^0.14.3",
    "lint-staged": "^6.1.1",
    "prettier": "^1.10.2",
    "prettier-eslint": "^8.8.1"
  },
  "scripts": {
    "mocha": "mocha test/ --recursive --exit",
    "precommit": "lint-staged",
    "start": "node src/",
    "test": "yarn run eslint && yarn run mocha"
  },
  "lint-staged": {
    "*.{js,jsx,css,md}": [
      "prettier --config --write",
      "eslint --fix",
      "git add"
    ]
  },
  "dependencies": {
    "@feathersjs/configuration": "^1.0.2",
    "@feathersjs/express": "^1.2.0",
    "@feathersjs/feathers": "^3.1.3",
    "compression": "^1.7.1",
    "cors": "^2.8.4",
    "helmet": "^3.11.0",
    "serve-favicon": "^2.4.5",
    "winston": "^2.4.0"
  }
}

Insecure Defaults Allow MITM Over TLS

Running nsp check using NSP's command line tool returns the following vulnerability:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               β”‚ Insecure Defaults Allow MITM Over TLS                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Name          β”‚ engine.io-client                                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Installed     β”‚ 1.6.8                                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Vulnerable    β”‚ <= 99.999.99999 || <= 1.6.8                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Patched       β”‚ None                                                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path          β”‚ [email protected] > [email protected] > socket.i… β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ More Info     β”‚ https://nodesecurity.io/advisories/99                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

There is no fix yet but we should include the fix as soon as it's released by engine.io-client.

An in-range update of debug is breaking the build 🚨

Version 2.6.5 of debug just got published.

Branch Build failing 🚨
Dependency debug
Current Version 2.6.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ

Status Details - βœ… **codeclimate/coverage** 100% [Details](https://codeclimate.com/github/feathersjs/feathers-socketio),- ❌ **continuous-integration/travis-ci/push** The Travis CI build failed [Details](https://travis-ci.org/feathersjs/feathers-socketio/builds/226661112)

Commits

The new version differs by 2 commits0.

  • 14df14c release 2.6.5
  • cae07b7 cleanup browser tests and fix null reference check on window.documentElement.style.WebkitAppearance (#447)

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Connection closed before receiving a handshake response

Currently, the code in server i use config like example.

app.configure(socketio(function(io) {
  io.on('connection', function(socket) {
    socket.emit('news', { text: 'A client connected!' });
    socket.on('my other event', function (data) {
      console.log(data);
    });
  });
}));

But code in client, i'm using like this:

import io from 'socket.io-client';

const socket = io('http://localhost:8080', { transports: ['websocket'], upgrade: false });

i got error like this on console

VM47643:161 WebSocket connection to 'ws://localhost:8080/socket.io/?EIO=3&transport=websocket' failed: Connection closed before receiving a handshake response

i search anything relate handshake response but i still can not connect socket.
FYI, when i directly config socketio in index.js, i can connect.

import socketio from 'socket.io';
const server = app.listen(8080);
const io = socketio(server);
server.on('listening', () =>
    logger.info(`Feathers application started on ${app.get('host')}:${port}`),
  );

An in-range update of feathers-hooks is breaking the build 🚨

Version 2.0.1 of feathers-hooks just got published.

Branch Build failing 🚨
Dependency feathers-hooks
Current Version 2.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As feathers-hooks is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details - βœ… **codeclimate/coverage** 100% [Details](https://codeclimate.com/github/feathersjs/feathers-socketio),- ❌ **continuous-integration/travis-ci/push** The Travis CI build failed [Details](https://travis-ci.org/feathersjs/feathers-socketio/builds/226685316)

Commits

The new version differs by 5 commits0.

  • 29dec05 2.0.1
  • 2c9f8ac Test for #154 and #155 (#156)
  • d2e59ee Fixed issue with __hooks being overwritten when reusing service (#155)
  • 1f55195 chore(package): update semistandard to version 11.0.0 (#152)
  • 7b450f5 Updating changelog

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-cli is breaking the build 🚨

Version 6.26.0 of babel-cli just got published.

Branch Build failing 🚨
Dependency babel-cli
Current Version 6.24.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-cli is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • βœ… codeclimate/coverage 100% Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of debug is breaking the build 🚨

Version 2.6.4 of debug just got published.

Branch Build failing 🚨
Dependency debug
Current Version 2.6.3
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As debug is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • βœ… codeclimate/coverage 100% Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 6 commits .

  • f311b10 release 2.6.4
  • 1f01b70 Fix bug that would occure if process.env.DEBUG is a non-string value. (#444)
  • 2f3ebf4 Update CHANGELOG.md
  • f5ae332 Update CHANGELOG.md
  • 9742c5f chore(): ignore bower.json in npm installations. (#437)
  • 27d93a3 update "debug" to v0.7.3

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Unable to use feathers from within React (Feathers vs SocketIO implementation setup issue)

Steps to reproduce

`
const io = require( 'socket.io-client/socket.io');
const feathers = require('feathers/client');
const socketio = require('feathers-socketio/client')

const socket = io('http://localhost:3030');

var client = feathers()
.configure(socketio(socket));
`

Expected behavior

Socket IO should be established and working.

When running a basic HTML only test the back end is setup correctly and working fine.

It's a little unclear in the documentation about how this should be working. Specifically I think there is an assumption that dependencies are added as global scripts and there are a number of hooks that might be clashing at that level.

Tell us what should happen

Actual behavior

Causes an exception of socketio is not a function(…)

System configuration

https://github.com/brewsoftware/hang-ten

  • cwd to the Client sub directory
  • npm install
  • npm run start

load a webpage of http://localhost:8080/

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
"feathers": "^2.0.2",
"feathers-hooks": "^1.6.1",
"feathers-socketio": "^1.4.2",
"socket.io": "^1.5.1",
"socket.io-client": "^1.5.1",

NodeJS version: NA (Client only)

Operating System: Windows

Browser Version: Chrome

React Native Version: React web

Module Loader: Webpack

Options are not passed to socket-io

According to the docs, options can be passed to engine-io

app.configure(socketio(options [, callback]))

Sets up the Socket.io transport with the given Socket.io options object and optionally calls the callback described above.

Steps to reproduce

const socketio = require("feathers-socketio")
const feathers = require("feathers")
const app = feathers()
app.configure(socketio({ pingTimeout: 500 }, (io) => { })

Expected behavior

Options should be passed to engine-io

Actual behavior

Options are not passed (pingTimeout is still default 60000)

engine handshaking client "Pc2Haio7MvD9rkT5AAAA" +0ms
engine:socket sending packet "open" ({"sid":"Pc2Haio7MvD9rkT5AAAA","upgrades":[],"pingInterval":25000,"pingTimeout":60000}) +2ms
engine:socket flushing buffer to transport +0ms
engine:ws writing "0{"sid":"Pc2Haio7MvD9rkT5AAAA","upgrades":[],"pingInterval":25000,"pingTimeout":60000}" +0ms

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
feathers-socketio 2.0.1

NodeJS version:
8.9
Operating System:
MacOS
Browser Version:

React Native Version:
0.46.4
Module Loader:

An in-range update of babel-core is breaking the build 🚨

Version 6.25.0 of babel-core just got published.

Branch Build failing 🚨
Dependency babel-core
Current Version 6.24.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-core is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • βœ… codeclimate/coverage 100% Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Better event filtering

Currently event filtering is only possible by implementing created, updated etc. methods on the service. This does not support custom service events (see feathersjs/feathers#133 and feathersjs/feathers#111) or filter chains. A better way would be to add a filter mixin method to services like this:

app.service('todos').filter('created', function(todo, params, callback) {});

feathers / graphql using REST / Sockets

Hello there,

I would thanks at first feathers team and all the work done here; I discovered feathers recently and it's just fun to use it everydays. I'm reading a lot about feathers (including articles from Medium and your blog as well).

I'm trying to integrate a websocket connection close to the working REST / Graphql working one but maybe some required experience from myself is not reached yet.

I started to follow these tutoriel to integrate a working feathers / graphql server :
https://github.com/swarthout/feathers-apollo/blob/master/docs/explanation-blog.markdown
https://medium.com/fuzz/the-electric-feathersjs-and-apollo-server-the-start-f338a744b34b

and I've been a lot helped by examples in :
https://github.com/EuropeanRespiratorySociety/api-ers
https://github.com/Akryum/vue-apollo

... as well for the server but also for the client (where I'm using Vue / Quasar framework).

For the websocket subscription, there's something I don't get. I started to follow an example from that repository from the same guy that made VueApollo :

https://github.com/Akryum/apollo-server-example

The example do not use at all feathers but this is the most pertinent example I found.

In my graphql servive file here is what I did :

// Initializes the `graphql` service on path `/graphql`

const graphql = require('graphql-server-express').graphqlExpress;
const graphiql = require('graphql-server-express').graphiqlExpress;
const makeExecutableSchema = require('graphql-tools').makeExecutableSchema;

const SubscriptionServer = require('subscriptions-transport-ws').SubscriptionServer;
const { execute, subscribe } = require('graphql');

const Resolvers = require('./graphql.resolvers');
const Schema = require('./graphql.schema');


module.exports = function () {
  const app = this;

  const executableSchema = makeExecutableSchema({
    typeDefs: Schema,
    resolvers: Resolvers.call(app)
  });

  SubscriptionServer.create(
    {
      schema: executableSchema,
      execute,
      subscribe
    },
    {
      server: app,
      path: '/graphql'
    }
  );

  // Initialize our service with any options it requires
  app.use('/graphql', graphql((req) => {
    return {
      schema: executableSchema,
      context: req.feathers
    };
  }));

  app.use('/graphiql', graphiql({
    endpointURL: '/graphql',
  }));
};

The schema and resolvers could be found here but not yet updated for sockets :

https://github.com/3kynox/BTCT/tree/saas-dev/server/src/services/graphql

I think the above example won't work because I'm using the same route (/graphql) for REST & Sockets, which is what I want. I would like to be able to use the same endpoint both for REST & Sockets.

I'll have to write some more code in the schema and resolver file to include subscription field and implement PubSub from graphql-subscriptions like it is done here :

https://github.com/Akryum/apollo-server-example/blob/master/schema.js

The problem with Akryum example two files is it uses a specific port on a dedicated /subscription endpoint, that deals with graphql on the client but separated from the /graphql rest endpoint I'm using and as said, I would like to uses both rest & websockets on the same endpoint.

Any guidelines to accomplish this ? I'm up to read more docs / examples if there is some related to what I'm doing.

Thanks anyway :)

Disable/restrict failed request queue?

Hi I'm searching for a way to disable or restrict the failed request queue to 1.
So basically socket.io queue's failed requests when network connection is gone and resends those when connection resumes.

How can I stop this behaviour or restrict the maximum amount of requests?

Clean way to subscribe to a filtered set of events

Say I wanted to implement a real-time chat app with multiple chat rooms that can be created and deleted dynamically. The client who is in chat room "football buddies" wants to subscribe to the messages service but is only interested in messages to that room. If I understand feathers correctly, feathers will send all events on the message service, which might be a lot if there are a lot of small chat rooms.

Perhaps the socket.io concept of namespaces and rooms is useful here, but I'm not sure of the best way to set it up within the feathers ecosystem.

I think feathers-reactive would effectively accomplish this from the point of view of my app, but the client side is still dealing with all the useless websocket traffic, which is undesirable.

I also see that event filtering might accomplish this, but it seems like I'd need to add some server-side functionality for tracking which users are currently connected to a given chat room, which seems less clean than simply being able to subscribe to a subset of the events on a service.

Any help is appreciated.

Thanks.

An in-range update of mocha is breaking the build 🚨

Version 3.5.2 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.5.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • βœ… codeclimate/coverage 100% Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v3.5.2

3.5.2 / 2017-09-10

πŸ› Fixes

Commits

The new version differs by 5 commits.

  • 72622ab Release v3.5.2
  • ac4c39f fix version in CHANGELOG.md [ci skip]
  • f06d969 update CHANGELOG for 3.5.2 [ci skip]
  • 9a3ddeb fix AMD bundle by hacking around check in he module; closes #3000
  • 337d317 fix broken links in CHANGELOG.md [ci skip]

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Connecting to sockets on a path

Steps to reproduce

Hello,
First, thank you for creating this module for Feathers. I have an app that has a number of pages. Only two of my pages require sockets. I need to have two different socket paths. For example:

  • /logs/feed
  • /customer-support/chat

In an attempt to do this, I have the following Feathers app setup:

const feathers = require('feathers');
const socketio = require('feathers-socketio');

const app = feathers();
const routes = require('./routes');

app.configure(configuration(path.join(__dirname, '..')));

app.use(compress())
  .options('*', cors())
  .use(cors())
  .use('/public', serveStatic(app.get('public'), staticFileSettings ))
  .use(bodyParser.urlencoded({ extended: true }))
  .configure(routes)
 .configure(socketio())  

In my routes file, I have paths like:

app.get('/logs/feed', function(req, res) {
  app.io.on('connection', function(socket) {
    console.log('connected to log feed!');
    socket.emit('client-connected', { result: 200 });
  });
  res.render('/logs/feed', {});
});

app.get('/customer-support/chat', function(req, res) {
  app.io.on('connection', function(socket) {
    console.log('connected to customer support chat');
    socket.emit('client-connected', { result: 200 });
  });
  res.render('/customer-support/chat', {});
});

In my app, I then try to connect via the socket.io client library like this:

var socket = io('/customer-support/chat');
console.log(socket.id);

var self = this;
socket.on('connect', function() {
  console.log('connected!');
  console.log(socket.id);
});

Expected behavior

The client side app should successfully connect via a socket over the desired path. That desired path is /customer-support/chat

Actual behavior

The client side app never connects to the server.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
feathers-socketio: "2.0.0"

NodeJS version:
v.6.9.4

Operating System:
WIndows 10

Browser Version:
Google Chrome

React Native Version:
N/A

Module Loader:
N/A

Filter service updates by ID

I'm trying to listen for updates on an 'event' service. I'm trying to listen to just the ones with a specific id.

This will give me all updates:

socket.on('event updated', (rEvent) => {
      console.log('Got an updated Event!', rEvent);
});

But what I'm looking for is something like this (only event w/id 34):

socket.on('event/34 updated', (rEvent) => {
     console.log('Got an updated Event!', rEvent);
});

I've gone through the docs, filtering, chat app...I don't have 'users' so I can't join an 'event' service on the user id. I'm struggling w/how to create a room for that specific 'event'.

What's the best approach for this?

Add headers and remote ip address to socket.feathers

This is too common of a request to not be next on the list. There are a lot of headers that match between the transports: https://gist.github.com/marshallswain/b775c7b6d7a9b2429b0eb6fe669a2bfd

We don't currently expose these headers for sockets.

app.configure(socketio(function (io) {
  io.on('connection', function (socket) {
    Object.assign(socket.feathers, {headers: socket.handshake.headers});
    socket.feathers.ip = socket.conn.remoteAddress;
  });
}));

Upgrade to socket.io 1.4

There seem to be no breaking changes (npm test is passing).
Operations returning large results would benefit from the automatic compression.

User object missing in logout callback args under certain conditions

I have a weird problem using app.on('logout', callback) on the server.

In my macOS-based dev environment it works just fine. The callback receives fully populated result and meta objects as arguments, of which I'm using meta.connection.user to update some data in the db.

In my Linux-based production environment however, meta.connection contains just this:

{
  "provider": "socketio",
  "payload": null,
  "user": null,
  "headers": {}
}

Both environments use node v9.11.1 with npm packages installed from an identical package.json. The only real difference in setup is a reverse proxy on the production server, but bypassing it doesn't change anything.

From package.json:

"dependencies": {
  "@feathersjs/authentication": "^2.1.5",
  "@feathersjs/authentication-client": "^1.0.2",
  "@feathersjs/authentication-jwt": "^2.0.0",
  "@feathersjs/authentication-local": "^1.1.2",
  "@feathersjs/configuration": "^1.0.2",
  "@feathersjs/errors": "^3.2.2",
  "@feathersjs/express": "^1.2.2",
  "@feathersjs/feathers": "^3.1.4",
  "@feathersjs/socketio": "^3.2.1",
  "feathers-authentication-hooks": "^0.1.7",
  "feathers-blob": "^2.0.0",
  "feathers-hooks-common": "^4.11.0",
  "feathers-nedb": "^3.0.0",
  "nedb": "^1.8.0",
  "socket.io-client": "^2.1.0"
}

What's going on here? Where should I look at next? Any pointers would be much appreciated!

– Christian

P.S.: When looking for a quick workaround, I've discovered a Symbol key in meta.connection which is also present in the production environment and contains all data needed. So my workaround now looks like this:

if (
  !connection.user &&
  Object.getOwnPropertySymbols(connection).length > 0
) {
  connection =
    connection[Object.getOwnPropertySymbols(connection)[0]]._feathers
}

An in-range update of mocha is breaking the build 🚨

Version 3.4.2 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.4.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • βœ… codeclimate/coverage 100% Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes fake-success

3.4.2 / 2017-05-24

πŸ› Fixes

πŸ”© Other

Commits

The new version differs by 7 commits.

  • a15b20a :ship: Release v3.4.2
  • fc802a9 :memo: Add Changelog for v3.4.2
  • 10ff0ec Eagerly set process.exitCode (#2820)
  • fc35691 Merge pull request #2818 from makepanic/issue/2802
  • 3e7152f Remove call to deprecated os.tmpDir (#2802)
  • e249434 Merge pull request #2807 from mochajs/npm-script-lint
  • 17a1770 Move linting into an npm script. Relates to #2805

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Updated from feathers-socketio to @feathersjs/socketio; error message

Steps to reproduce

I updated my modules from feathers- to @feathersjs/ , socketio being one of them.
Now I am getting this error:

This relative module was not found:

* ./lib/client in ./node_modules/@feathersjs/socketio/client.js

Expected behavior

Expecting it to just work

Actual behavior

Received the error above. When I inspected the module there indeed is no client.js in lib folder - it's named index.js

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

    "@feathersjs/authentication": "^2.1.0",
    "@feathersjs/authentication-client": "^1.0.1",
    "@feathersjs/authentication-jwt": "^1.0.1",
    "@feathersjs/authentication-local": "^1.0.2",
    "@feathersjs/configuration": "^1.0.1",
    "@feathersjs/errors": "^3.2.0",
    "@feathersjs/express": "^1.1.2",
    "@feathersjs/feathers": "^3.0.2",
    "@feathersjs/socket-commons": "^3.1.5",
    "@feathersjs/socketio": "^3.0.1",
    "@feathersjs/socketio-client": "^1.0.1",
    "@nuxtjs/axios": "^4.5.0",
    "axios": "^0.17.1",
    "body-parser": "^1.18.2",
    "compression": "^1.7.1",
    "cookie-storage": "^3.1.0",
    "cors": "^2.8.4",
    "cross-env": "^5.1.3",
    "feathers": "^2.2.3",
    "feathers-authentication-hooks": "^0.1.6",
    "feathers-authentication-management": "^0.4.0",
    "feathers-hooks-common": "^3.10.0",
    "feathers-mailer": "^2.0.0",
    "feathers-mongoose": "^5.1.2",
    "feathers-nedb": "^2.7.0",
    "feathers-rest": "^1.8.1",
    "feathers-vuex": "^1.1.1",
    "handlebars": "^4.0.11",
    "helmet": "^3.9.0",
    "mongoose": "^4.13.7",
    "nedb": "^1.8.0",
    "nodemailer-postmark-transport": "^1.3.0",
    "nodemailer-smtp-transport": "^2.7.4",
    "nodemon": "^1.14.1",
    "nuxt": "^1.0.0-rc9",
    "path": "^0.12.7",
    "pug": "^2.0.0-rc.4",
    "rxjs": "^5.5.6",
    "serve-favicon": "^2.4.5",
    "socket.io-client": "^2.0.4",
    "tippy.js": "^2.0.8",
    "vee-validate": "^2.0.0-rc.27",
    "vue-paypal-checkout": "^2.1.8",
    "vue-stripe-elements-plus": "^0.2.6",
    "winston": "^2.4.0"
  },
  "devDependencies": {
    "eslint": "^4.13.1",
    "mocha": "^4.0.1",
    "request": "^2.83.0",
    "request-promise": "^4.2.2"
  }

NodeJS version:

Operating System:
MacOS Sierra 10.12.5

Browser Version:
Opera 49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.