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

Added proxy support to client #40

Merged
merged 7 commits into from
Dec 5, 2019
Merged

Conversation

mnashmi
Copy link
Contributor

@mnashmi mnashmi commented Dec 4, 2019

Proxies are not a supported param by stream_socket_client() and is the http.proxy option is completely ignored. php.net/manual/en/context.socket.php

The change will first connect to a tcp proxy, issue the CONNECT command to the host, and then use the proxy to relay any data to the WebSocket.

@arthurkushman
Copy link
Owner

Thank u, can u make a new PR to develop branch instead of master, so we can work more separately on this feature?

@mnashmi mnashmi changed the base branch from master to develop December 4, 2019 15:34
@@ -19,6 +17,12 @@ class ClientConfig
private $fragmentSize = WscCommonsContract::DEFAULT_FRAGMENT_SIZE;
private $context;


private $has_proxy = false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's support the lib standard of camelCase properties naming - e.g.: $hasProxy would be preferable and so on for others



//do we have a proxy?
$proxy_ip = '';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U have an instance of ClientConfig here via $config prop, so there is no reason to create all these vars locally

$proxy_port = '';
$proxy_auth = '';

if ($this->config->getProxy($proxy_ip, $proxy_port, $proxy_auth)) {
Copy link
Owner

@arthurkushman arthurkushman Dec 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this-config->hasProxy would be a better design for checking whether it is a proxy or not and then if it is - $this-config->getProxyHost(), getProxyPort, get ProxyAuth etc

@arthurkushman arthurkushman changed the title Added proxy support Added proxy support to client Dec 5, 2019
@arthurkushman
Copy link
Owner

arthurkushman commented Dec 5, 2019

The request feature is good, we just need to set all things up to provide more compatible code with the code-base.

@mnashmi
Copy link
Contributor Author

mnashmi commented Dec 5, 2019

changes have been made

@arthurkushman arthurkushman merged commit c322974 into arthurkushman:develop Dec 5, 2019
@arthurkushman
Copy link
Owner

Good work - thx

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

Successfully merging this pull request may close these issues.

2 participants