Skip to content

mic1780/websockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Websockets

This project is for a websocket server in C

If you are looking for a modular websocket style server, check out the modular branch here

Current Requirements

  1. GNU GCC compiler
  2. Access to a command-line that has BASH

Some of the code must be changed due to this program being developed for use from a specific directory. This will be changed over time while I make the files more dynamic. I eventually plan to get rid of the PHP files and replace them with a C version of database connection. In the meantime feel free to use and alter this project however you see fit.

Getting Started

Simple setup (using compile defaults)

  1. Download files using clone or extracting the zip
  2. Navigate to the directory you extracted the files to using the command line
  3. To build the application (assuming nothing has been compiled yet) simply run the following command:
    ./compile.sh -b
  4. To run your newly created server run the following command:
    ./compile.sh -r
  5. If you want to see the list of available console commands for the server type in "help" after the server has started.
  6. Enjoy your new websocket server

Advanced Setup

  1. Download files using clone or extracting the zip
  2. Navigate to the directory you extracted the files to using the command line
  3. You can run the following command to compile everything for you.
    ./compile.sh -b
    If you did not run the above command then continue to the next step.
  4. All files need the libfunctions library so we need to generate it first:
    ./compile.sh -f
    Or if you have your own global functions in seperate files you can generate them with libfunctions at the same time:
    ./compile.sh -f libfunctions [your global function files]
  5. Once you have generated your libfunctions library, next you will need to generate your dynamic function libraries:
    ./compile.sh -l
    This will compile the default dynamic libraries. This commands is the same as doing the following:
    ./compile.sh -l sendMessage alterStruct performAction callFunction
  6. Finally, you need to actually create the main executable. This can be done using the following command:
    ./compile.sh -a
    This gives the compiled application the default name websocket.exe on Windows or websocket.out on UNIX.
  7. Now you can run your new application:
    ./compile.sh -r
    This will run your server application using this default name websocket.exe on Windows or websocket.out on UNIX
  8. Enjoy your new websocket server

If you want to know what compile.sh does you can run it with the -h flag to bring up help

How do I use it?

Windows:

On windows you can do one of the following to start your websocket server (for websocket.exe only):

  • double-click run.exe
  • Open a Command Prompt (Shift + Right Click in windows explorer and "Open command window here") and enter the following:
    run.exe
  • If you use a linux shell (for example: Cygwin), you can enter the following command in it:
    ./run.exe

Linux / Unix

  • Using the command-line, change directories to where you created the websocket server then
    ./run.out
  • If you have a file explorer, navigate to folder where you created the websocket server then open run.out (untested)

Questions?

If you have any question or have found any bugs with this application please let me know on GitHub or crate an issue with what happened and how I can reproduce the problem.

Want to help?

If you are interested in helping me improve this program feel free to make changes and tell me about what youu did and why it would help the server be more efficient, fast, or more dynamic (dynamic be how can I keep the server online while I make revisions / changes to the dynamic libraries). I am still trying to figure out how this should be used and I am trying to include all potential uses of this program (like IM servers, chat rooms, notification pusher/puller, live updates, etc.). Any help / ideas are welcome.