Following the instructions from https://github.com/voryx/Thruway I am trying to set up a websocket server on localhost (Windows) which will only give me WebSocket connection to 'ws://127.0.0.1:9090/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I started the server via > php vendor/voryx/thruway/Examples/SimpleClient.php which gives me the following console output:
2016-11-19T18:58:56.4982780 notice [Thruway\Peer\Client 308] Changing PHP precision from 14 to 16
2016-11-19T18:58:56.5007740 info [Thruway\Peer\Client 308] New client created
2016-11-19T18:58:56.5016600 info [Thruway\Transport\PawlTransportProvider 308] Starting Transport
on the client side I am using the recommended example from https://github.com/crossbario/autobahn-js. Which should work - I could successfully connect to the testserver ws://demo.thruway.ws:9090.
Tested in latest Chrome on Windows 10 php7.
Any help or hints would be highly appreciated.
I'm not sure if it's just a typo, but the example router is SimpleWsRouter.php not SimpleClient.php
Related
I have installed to a computer, MS SQL Server 2016 Developer Edition and created through Management Studio 17 an instance and a database. On another computer that runs IIS7, i enabled PHP extension through FastCGI and created an application.
In my application i try to run a php file with the following code:
<?php
$conn = mysql_connect('IP_OF_SQL_SERVER_INSTALLATION', 'USER_OF_SQL_DB', 'PASSWORD_OF_DB_USER', 'PORT_USED_FOR_SQL_APP')
or die('Error connecting to mysql: '.mysql_error());
?>
i wait for around 1 minute and then i get 500 - Internal server error. In SQL computer, i have enabled TCP/IP for my instance, i have opened ports 1433 (TCP) and 1434 (UDP) from windows firewall as inbound rules. Also i installed Management Studio 17 to another computer to the same network and when i try to connect from there, i get a connection. Any ideas on this?
Thank you in advance
After a research i'm gonna try to explain the whole process i've been trough to try to solve the problem.
First, the idea was to make a WebSocket connections with the users of my app with the server to basically share some information, all this process works perfectly if we are not under SSL.
The moment my server was secured, i got two messages, first, i couldn't do a connection to a non secure WebSocket Service under SSL, obvious reasons. Then i tried the secure connection and also failed with a 400 hand shake failure.
Then i started my research about the problem, i saw that ratchet documentation didn't tell me anything new about this matter, at least not that could find. After that, i found this.
php ratchet websocket SSL connect?
I asked my provider to install and configure this Apache modules (Apache version 2.4.25, just in case that gives any valuable information). The configuration worked since now i can make the connection with the ws://www.website.com /ws/ and works fine. But now when i try wss connection, i get a timed out response:
/* Apache error
[Mon Feb 06 16:49:02.966991 2017] [cgi:error] [pid 8969] (70014)End of file found: [client ipadress:port] AH01225: Error reading request entity data
[Mon Feb 06 16:51:42.530383 2017] [cgi:error] [pid 9837] (70014)End of file found: [client ipadress:port] AH01225: Error reading request entity data
*/
And the last thing, about the Stunnel configuration, im not sure what ports should i use on those variables.
https://www.stunnel.org/config_unix.html
[websockets]
accept = 8443
connect = 8888 //i guess here the port where my WS is running?
For now, with all this information and the research i did, i'm not able to find any other clue that could help me solve this.
Thanks in advance.
Please check the answer here, where I share how to configure Apache server to access wss:// and ws:// at the same time.
PHP websocket on SSL with proxy_wsTunnel - Apache
After hours of strugling with Radchet i've got it working on a new Windows 2016 machine with IIS 10.0.
My Ratchat server is started from the commandline, and is running on localhost:8585
Using Windows 2016 with IIS10.0, installed the Websocket feature (but not used in IIS).
Created a new website, with HTTPS binding on port 443.
This site is a dummy site, no html / web files.
Create a Application Proxy rewrite rule, see web.config:
The client can connect with the wss://yoursertcomain.com:443 and IIS will pass the requests to/from Ratchet.
Our application is now over WSS up-and-running.
PS: Using the loopback IP-adress 127.0.0.1 instead of 'localhost', otherwise connecting takes 1 second, now it's serveral ms.
I am using the Laravel Framework and BrainSocket to open up a websocket service in a port via the following command line:
php artisan brainsocket:start --port=7778
Afterwards, I connect to the websocket on the client-side, like so:
var websocket = new WebSocket('ws://127.0.0.1:7778/');
At first I was developing this application on my local machine and everything was working fine. However, on the production server (CentOS 7 + Nginx), when I run the above line the following error message appears:
WebSocket connection to 'ws://127.0.0.1:7778/' failed: Connection
closed before receiving a handshake response
I tried changing the IP for the server's IP address, I have already checked if the port was being used and I made sure socket support was enabled. But whatever I do the same error message appears.
It worked once I used port 443 instead.
We are using Symfony 2.2 with the OldSound RabbitMqBundle. A rabbitmq server is running on another instance. The server configuration is fine as everything is working on localhost and messages are sent and retrieved from/by the server.
On our managed server we get following error by starting a rabbitmq:consumer. This must result from any missing permissions, closed ports or some other circumstances, which are different on the managed server (hetzner) than on the localhost.
Do you have any idea how to analyse or fix this problem?
Executed Command:
:~/../app$ php console rabbitmq:consumer -m 100 transfer_data
Error message:
[PhpAmqpLib\Exception\AMQPRuntimeException]
Error Connecting to server(111): Connection refused
rabbitmq:consumer [-m|--messages[="..."]] [-r|--route[="..."]] [-l|--memory-limit[="..."]] [-d|--debug] [-w|--without-signals] name
My project uses PHP JavaBridge, I have installed WAMP, JRE 6.0, and Tomcat 6.0.32
I can now access http://localhost:8080/ successfully but when I run my PHP site it gives me the following error
warning: fsockopen() [function.fsockopen]: unable to connect to localhost:8080 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
Can anyone please help me with this issue?
EDIT
Forgot to mention that I am using Windows 7
My comment above worked as a solution and hence this answer, so that in future others get it.
Can you 127.0.0.1:8080 instead of localhost:8080? See what do you get?
fsocketopen takes the hostname and it should be a valid domain, in your case, (in general) it could be a valid domain as long as you have an entry for localhost in your hosts file (C:\Windows\System 32\drivers\etc\hosts). See if you have something similar to that.