fix: encode ws url (#3498)
Summary: Some clients require encoded ws url. For example on Android (running in Rect Native), plain URL like this: `ws://10.0.2.2:8333?device_id=ReactNative1646120067758.0.2246373385349361&device=ReactNative&app=React Native App Google - Android SDK&os=ReactNative` will throw error during connection. To not require param encoding when starting the `flipperClient.start()`, it is easier to encode entire `url` before starting the ws server. ## Changelog - encode url for `js-flipper` ws server Pull Request resolved: https://github.com/facebook/flipper/pull/3498 Reviewed By: aigoncharov Differential Revision: D34638857 Pulled By: lblasa fbshipit-source-id: 9eb0e268c7bacb5febc19bbb45fe6814fb7a60de
This commit is contained in:
committed by
Facebook GitHub Bot
parent
07ee7fa706
commit
8416372c8f
@@ -214,8 +214,9 @@ export class FlipperClient {
|
||||
|
||||
private connectToFlipper() {
|
||||
const url = `ws://${this.urlBase}?device_id=${this.device}${this.devicePseudoId}&device=${this.device}&app=${this.appName}&os=${this.os}`;
|
||||
const encodedUrl = encodeURI(url);
|
||||
|
||||
this.ws = this.websocketFactory(url);
|
||||
this.ws = this.websocketFactory(encodedUrl);
|
||||
|
||||
this.ws.onerror = (error) => {
|
||||
this.onError(error);
|
||||
|
||||
Reference in New Issue
Block a user