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

Ratchet Push Integration Tutorial (Windows/XAMPP) #289

Closed
mcep5f2009 opened this issue Mar 6, 2015 · 2 comments
Closed

Ratchet Push Integration Tutorial (Windows/XAMPP) #289

mcep5f2009 opened this issue Mar 6, 2015 · 2 comments
Labels

Comments

@mcep5f2009
Copy link

Hello everyone,

I am trying to get the Ratchet Push Integration Tutorial working and have run into a few issues. I am using Windows 7 and XAMPP. This issue has also been posted here.

  1. When I run the following in cmd.exe (command line) to start the executable (push-server.php) nothing seems to happen:

C:\xampp\htdocs>php bin/push-server.php

There is a flashing prompt below the line but nothing else happens. I have to hit Ctrl + C to get out of it.

  1. When I first loaded the page with the client side script in my web browser I got the following errors (in the JavaScript console):
  • Mixed Content: The page at 'https://localhost/' was loaded over HTTPS, but requested an insecure script 'http://autobahn.s3.amazonaws.com/js/autobahn.min.js'. This request has been blocked; the content must be served over HTTPS.
  • Uncaught ReferenceError: ab is not defined
  • [blocked] The page at 'https://localhost/' was loaded over HTTPS, but ran insecure content from 'ws://localhost:8080/': this content should also be loaded over HTTPS.
  • Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

Since my website runs over HTTPS I made the following changes:

However, after these changes I still get the following error and warning:

  • WebSocket connection to 'wss://localhost:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
  • WebSocket connection closed

As I was setting up the push integration tutorial I documented everything I did step by step. You can view this document here. I'm hoping someone will be able to help me figure out where I went wrong so that I can get the push integration tutorial working. Please feel free to make changes to the document I attached with any corrections. I think it would be useful to have a correct version of this step by step document to help people setup this tutorial in Windows & XAMPP.

Please let me know if you have any questions. I greatly appreciate all of your help!

@cboden
Copy link
Member

cboden commented Mar 14, 2015

  1. This is working as intended. push-server.php is a long running process that waits for incoming connects.

  2. React, the library that manages I/O for Ratchet, does not support SSL. To enable SSL you'll need a reverse proxy to connect to (STunnel, Nginx, etc).

@nevergrind
Copy link

nevergrind commented Oct 31, 2016

Something like this works in your httpd.conf

ProxyPass /wss2/ ws://localhost:8080/

And then in javascript using Autobahn.js:

push = new ab.Session('wss://localhost/wss2/', function(){
    push.subscribe('mySocketChannel', function(topic, data) {
        // do stuff
        console.info('New article published to category "' + topic);
        console.info(data);
    });

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

No branches or pull requests

3 participants