feathers icon indicating copy to clipboard operation
feathers copied to clipboard

how to support two websockets

Open adambezecny opened this issue 5 years ago • 1 comments

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

adambezecny avatar Nov 20 '19 11:11 adambezecny

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.

daffl avatar Dec 10 '19 20:12 daffl