johnnymast / mysql_websocket_chat

Quickly get a websocket chat up and running
MIT License
21 stars 11 forks source link

Error: Currenty there is no connection to the server. reconnecting in 10 #28

Closed nishanth6 closed 6 years ago

nishanth6 commented 6 years ago

As I'm using xampp server

config.php

`<?php date_default_timezone_set('EUROPE/AMSTERDAM');

define ('DATABASE_HOST', 'localhost'); define ('DATABASE_USERNAME', 'root'); define ('DATABASE_PASSWORD', ''); define ('DATABASE_DB', 'socket_chat'); define ('ENABLE_DATABASE', true);

/**

` I tried to run aa

http://localhost/chat/chat/index.php

Got the Error as

Error: Currenty there is no connection to the server. reconnecting in 10

johnnymast commented 6 years ago

Hey @nishanth6,

Did you run the server as well ?

nishanth6 commented 6 years ago

@johnnymast Yes, I had xammp server running with MySQL. and I also imported the DB and in config define ('ENABLE_DATABASE', true);

johnnymast commented 6 years ago

Maybe you should switch off the database (for now) and try again to eliminate possible errors.

johnnymast commented 6 years ago

Alright i have spotted the error.

  1. change CHAT_SERVER_PORT back to 8080
  2. Set XAMPP up and point it to the directory with index.php
  3. On the command line start php ./server.php

This will run index.php from xampp, this creates html and will connect to the server on port 8080. So server.php will bind to port 8080.

nishanth6 commented 6 years ago

capture

No Good it didn't solved the problem

@johnnymast

johnnymast commented 6 years ago

Is your version on github ?

johnnymast commented 6 years ago

@nishanth6 is your index.php located in the root of your webserver? (and not something like /chat/index.php)? Im asking because:

<script type="text/javascript" src="/js/dom.js"></script>
<script type="text/javascript" src="/js/websockets.js"></script>
<script type="text/javascript" src="/js/interface.js"></script>

If your document root is /chat (or something) then these files and the stylesheets are not found. You might want to change the script urls or your document root.

johnnymast commented 6 years ago

This issue will be resolved in version 1.4. For now remove the prefix / from the local script and css links in the html and you will be good to go.

Happy coding ! :octocat: 👍