PredixDev / predix-webapp-starter

A web application starter kit built on Polymer, Web Components, NodeJS and Predix UI Components
https://predix-webapp-starter.run.aws-usw02-pr.ice.predix.io
Other
61 stars 75 forks source link

Socket connection from browser to custom microservice through webapp-starter #11

Open akshayeshenoi opened 6 years ago

akshayeshenoi commented 6 years ago

Hi! Is it currently possible to reverse-proxy WebSocket connections initiated by the browser to a custom microservice? The lack of it requires the front-end to connect to the microservice directly which entails authentication woes.

gstroup commented 6 years ago

No, currently the webapp-starter does not support proxying websocket connections. It's a good idea, and something we've considered. For now, you could look at the predix-toolkit code for an example of proxying web socket connections. https://github.com/PredixDev/predix-tool-kit/blob/master/server/security-app.js

Also, this npm package is very popular, and supports web socket proxying: https://github.com/nodejitsu/node-http-proxy

akshayeshenoi commented 6 years ago

Would you be willing to accept a PR?

gstroup commented 6 years ago

Yes, I think a PR would be useful. How are you planning to implement it?

akshayeshenoi commented 6 years ago

Kind of like how it's implemented in the predix-toolkit example code you shared.

All communication will depend upon this socketID. Sounds good?

gstroup commented 6 years ago

Sounds good. Let's try to keep most of this logic in a separate file in the /server directory. Thanks for the initiative.