Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy Websocket and global error handler #53

Open
mburger81 opened this issue Nov 30, 2016 · 6 comments
Open

Proxy Websocket and global error handler #53

mburger81 opened this issue Nov 30, 2016 · 6 comments

Comments

@mburger81
Copy link
Contributor

mburger81 commented Nov 30, 2016

I know this is not a issue but I don't know how I can ask you something.

We are using your websocket in an ionic2 project and it's working great.
There are three things we like to do.

  1. we would like to proxy it like normal http requests, this for testing
  2. we need a global point where we can configure the url to call, this for production
  3. global error handling

this is how we implemented it for regular http requests

  1. We configure a proxy in our ionic configuration for /api which is working only in dev mode so all HTTP requests where redirected and there is no CORS problem, we found no solution to proxy also Websockt requests. Do you have an idea=

  2. We created a CustomHTTP Interceptor which is used instead of the regular HTTP, this checks if environment is dev or production, if dev we leave the url as it is, in dev mode means /api/ which will be redirect by proxy configuration, if we are in production I change the url to https.... or an other url, it depend if we are on a device or on a browser.

  3. With this interceptor also we can handle http errors and log them.

So we need to do the same thing with your websocket implementation. Did you do something like that before? do you have some examples or some ideas to share with us? We can also open an stack-overflow to discuss this.!

thx for you help

@afrad
Copy link
Owner

afrad commented Nov 30, 2016

Hi @mburger81,
These are separates feature requests. I think it would be better they should be posted as new issues.

@mburger81
Copy link
Contributor Author

Hi @afrad
yea this could be a feature request and for sure not a issue. I know, but here I can't open a feature request, or could I? I didn't found it.

My hope was, you could help us implementing this things or perhaps do you have already done some of this things in some of your projects, because I think it is not necessary implementing this, we could also resolve this using a dedicated service, observable or something like that.

@mburger81
Copy link
Contributor Author

Some news?

@mburger81
Copy link
Contributor Author

HI @afrad, I'm still waiting for some news about it.
Where can I open you a feature request? How is it about including Websocket + webpack + http-proxy implementation for proxy a websocket call?

@afrad
Copy link
Owner

afrad commented Feb 13, 2017

Just create PRs accordingly. We will merge them.

@mburger81
Copy link
Contributor Author

I think this FR doesn't make sense, because you never can proxy WebSocket like a http request doing something like that
new WebSocket('/proxy/blabla/....');
because native WebSocket implementations check for the ws url which should start with ws:// or ws:// it would never work.

@afrad right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants