Skip to content
vmiloserdovPublic

About

Chat room I made for one of my projects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

CyberChat

This is a chatroom that I have coded up a while ago for one of the my projects.

Prerequisites

  • Web Browser: Google Chrome is recommended for the best experience.
  • Python 3: Ensure Python 3 is installed to run the server script.
  • Code Editor: Any code editor (e.g., VS Code, PyCharm) to manage the server script.
  • Ngrok: A tool to expose your local server to the internet.

Configuration

  • REQUIRED_HUMAN_AGENTS: This setting allows you to specify the number of human participants the chatroom is expecting. Adjust this value in the configuration or relevant script (e.g., server_script.py or chatViews.py) to match the desired number of users.

Installation

Installing Ngrok

To make the chatroom accessible across devices, you'll need to install Ngrok.

  • Mac: Run the following command in your terminal:

    brew install ngrok
  • Other Platforms (Windows, Linux, etc.): Download Ngrok from the official website: https://ngrok.com/download. Follow the instructions there to install it.

Running the Chatroom

Follow these steps to set up and run the chatroom:

  1. Open the Chatroom UI:

    • Open the chatRoom.html file in Google Chrome (or another modern browser).
  2. Run the Server Script:

    • Open your code editor and navigate to the directory containing server_script.py.
    • In a terminal, run the following command to start the server (if you want to use ngrok):
      python3 server_script.py 0.0.0.0 8080
      or (if you want to run on the local machine and not use ngrok)
      python3 server_script.py localhost 8080
    • This will start the server on port 8080.
  3. Expose the Server with Ngrok:

    • In a separate terminal, run the following command:
      ngrok http 8080
    • Ngrok will generate a public URL, such as:
      Forwarding  https://abc123.ngrok-free.app -> http://localhost:8080
      
    • Copy the public URL (e.g., abc123.ngrok-free.app).
  4. Connect to the Chatroom:

    • In the chatRoom.html interface, locate the Server Address field.
    • Paste the copied Ngrok URL (e.g., abc123.ngrok-free.app) into the Server Address field.
    • Enter the username and connect to the server.

Django Views

  • The chatViews.py file contains the Django views that handle the backend logic for the chatroom. Ensure this file is properly configured within your Django project to manage chatroom functionality, such as message handling and user connections.

Usage

Once connected, you can communicate with others across different devices using the chatroom interface. Ensure the server script and Ngrok are running continuously to maintain the connection. The REQUIRED_HUMAN_AGENTS setting ensures the chatroom waits for the specified number of participants before enabling full functionality.

Troubleshooting

  • Server not running: Ensure the python3 server_script.py 0.0.0.0 8080 command is active and there are no errors in the terminal.
  • Ngrok URL not working: Verify that Ngrok is running and the correct URL is copied. Check for typos in the Server Address field.
  • Browser issues: If the UI does not load correctly, try refreshing the page or using Google Chrome.
  • Django views errors: Ensure chatViews.py is correctly integrated into your Django project and all dependencies are installed.

For additional help, refer to the Ngrok documentation: https://ngrok.com/docs or the Django documentation: https://docs.djangoproject.com.

About

Chat room I made for one of my projects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages