Created: 21/03/2016
Updated: 09/05/2017
Version: 2.0.1

By: Misscodi

Email: [email protected]
Skype: nberk97

WebSocket Live Chat (Instant Messaging)

Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to email or ask from Skype. Thanks so much!

WebSocket Live Chat is an instant messaging script that you can create groups and send personal messages. It is suitable for both social messaging and live support systems. It is written in PHP, MySQL, JQuery, Javascript and designed with CSS. This script uses WebSocket Connection, which provides the instant messaging, between the client and the server.

Requirements

  • PHP 5.5+ (with CURL and SOCKETS extensions)
  • MySQL 5.x
  • A Server with SSH Access


  • NGINX is not supported.
  • CentOS is not supported due to a problem with WebSocket listener.
  • Installation


    1) Upload Files

    Upload the files in "Codes" folder to your web server.

    "server.php" file in "ws" folder does not have to be located in "ws" folder. You can also host it in an another server.


    2) Configure Your Settings

    Configure your database settings and if you want to enable "Forgot Password System" or "Email Activation System", configure email settings in "config.php" file. This file is located in "include" folder.

    Then, configure the settings at the beginning of the "server.php" file same as "config.php" file.


    3) Run Installation Script

    Go to "domain.com/installation.php" page and follow the steps.


    4) Open Port

    You need to open WebSocket Listener's port. Default value is 9000. This process depands on your server. If you do not know how to open a port, ask how to do to your service provider.


    5) Start the WebSocket Listener

    To make instant messaging work, you need to start WebSocket Listener on your server. First open a command line or connect to your server with SSH and type the command below.


    php -q D:\xampp\htdocs\ws\server.php

    "D:\xampp\htdocs\ws\server.php" is the destination of "server.php".

    This command line must remain open in order to keep instant messaging working. However, if you connected to your server with SSH, the connection will be timed out. Do the step below.

    If your server is Ubuntu (Most linux are the same) and you have cronmod, then you can use the command below to keep the process running.


    First type "crontab -e" to your server's command line. Then add the code below.


    @reboot (php -q /var/www/html/ws/server.php &)


    Then save it.

    This will start the WebSocket listener on bootup.

    OPTIONAL


    Secure Connection (HTTPS & WSS)

    Unfortunately, using HTTPS requires some configuration in the web service. First of all, you need "proxy_wstunnel_module". You can see the loaded modules by creating a php page. Add the code below to see loaded modules.


    print_r(apache_get_modules());

    If "proxy_wstunnel_module" is not loaded, you need to install this module first.

    Now, you need to configure "wstunnel.conf" file. Location of this file depands to your web service but I will give you the location for "httpd" and "apache2".

  • For "httpd": /etc/httpd/conf.d/wstunnel.conf
  • For "apache2": /etc/apache2/conf.d/wstunnel.conf
  • If "wstunnel.conf" file does not exist, create one.

    To create and edit over SSH, type the following commant to your SSH.


    sudo nano /LOCATION/wstunnel.conf

    This command will open a text editor in SSH. Now, type the code below.


    ProxyPass /wss ws://IP_OR_DOMAIN:PORT/server.php

  • IP_OR_DOMAIN: IP or domain address of websocket listener. It must be same as in the "config.php" file.
  • PORT: Port of the websocket listener.

  • Now, to save the file, click "ctrl + x" and type "y", then click "enter".

    Now go to Admin Panel > Settings > General Settings and change "WebSocket Listener URL" with "IP_OR_DOMAIN/wss". Don't include the port and "server.php".

    "wstunnel.conf" and "config.php" files should look like below.

    Finally, restart your web service.


    • Screenshots





    Importing SQL File

    To import a SQL file to your database, follow the steps below.

    • How to Import Using phpMyAdmin?
      a) Select Your Database
      b) Click "Import" Button
      c) Browse Your SQL File and Click "Go" Button


    Get a Google API Key

    To get a API key for location sharing, go to this website.

    • Introductions