Created: 24/08/2016
Updated: 14/10/2016
Version: 1.1

By: Misscodi

Email: [email protected]
Skype: nberk97

WebSocket Live Chat (Instant Messaging) - WP

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
  • Wordpress 3.5.0+
  • A Server with SSH Access
  • Installation


    1) Upload "Server.php File"

    First of all, open "server.php" and configure the required areas at the beginning. Then, upload the file to your server that has SSH access. You don't have to use the same server that you use wordpress.


    2) Install the Plugin

    Install the "websocket-live-chat.zip" plugin to wordpress.

    During the installation an error might be occured while creating some folders. Please check the following paths, if the folders are exist and make sure their permissions are 777.

  • WORDPRESS_DIR/wp-content/plugins/websocket-live-chat/include/img/
  • WORDPRESS_DIR/wp-content/plugins/websocket-live-chat/include/img/share/

  • 3) Configure Plugin Settings

    It's successfully installed. Now go to settings on Wordpress's admin panel and configure the settings.

    Please configure "WS Settings" page carefully. If something is wrong, the plugin may not work correctly.


    4) Open Port for Websocket Listener

    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\server.php

    "D:\xampp\htdocs\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/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