feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.08k stars 750 forks source link

how to support two websockets #1694

Open adambezecny opened 5 years ago

adambezecny commented 5 years ago

we are configuring websocket for our feathersjs app in following way

const feathers = require('@feathersjs/feathers')
const expressFs = require('@feathersjs/express')
const socketiofs = require('@feathersjs/socketio')
const appFs = expressFs(feathers())

  appFs.configure(socketiofs({
    path: '/vapapi/channels/webchat/v1'
  }))

Then later in the code we are accessing the websocket like this:

this.ws = feathersjsApp.io

Is it possible to have secondary websocket with different path (existing in parallel with first one), i.e.

  appFs.configure(socketiofs({
    path: '/vapapi/channels/webchat/v2'
  }))

We still need to access underlying socket directly, something like

this.ws2 = feathersjsApp.io2????? (i know this will not work:) )

Please advise whether this is feasible and how to do it. We basically need to access websocket directly because we are wrapping it in redis adapter

daffl commented 4 years ago

Socket.io only allows to run one instance on a server. This Stackoverflow question recommends to use namespaces but I'd have to look how this would work with setting up different namespaces.