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

Android Webview can't open connection to ws://localhost #71

Open
bcjat opened this issue May 17, 2020 · 4 comments
Open

Android Webview can't open connection to ws://localhost #71

bcjat opened this issue May 17, 2020 · 4 comments

Comments

@bcjat
Copy link

bcjat commented May 17, 2020

I have googled and found that chrome webview can't open connection to WebSocket server that is unsecure. So please describe how to run WebSocketServer using secure context with TLS?

@becvert
Copy link
Owner

becvert commented May 17, 2020

Do you connect from a secure url https://localhost ? It won't work in that case.
This plugin does not support TLS.
As is, it's meant to be run into a local network between trusted devices.
Unless you can PR a solution.

@bcjat
Copy link
Author

bcjat commented May 17, 2020

I setup server in one device with port 8888. Now I make connection from another device using var webClient = new WebSocket( "ws://localhost:8888"); but it gives ERR_CONNECTION_REFUSED. So I googled about this error and found that chrome webview does not allow non secure ws:// connection to localhost it should be wss://. What will be solution for this case.

@becvert
Copy link
Owner

becvert commented May 17, 2020

Mixed content is not allowed. But unsecure websocket from an unsecure origin is allowed.
Did you remove the origins and protocols options from the WebSocketServer config?

@bcjat
Copy link
Author

bcjat commented May 18, 2020

Yes I had removed that both options from config. Is it needed for unsecure context? If yes then what will be values for those both options?

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