CodeIgnitor 4 with Websockets

Job ID: 33742794

Budget: £20 – £250 GBP

I have an C# desktop application that communicates with a web server using websockets. I would like an example web app created in an empty/new CI4 project that allows for the following:

- At least 10,000 simultaneous connections and 60 messages a minute
- Clients to send JSON encoded messages to the server
- Server can identify the client sending a message using custom headers / URI info
- Server stores/logs received client messages in MySQL
- Server knows which clients are connected/online at all times (MySQL)
- Server can send a message to a specific client using the client's ID (from MySQL). I need to be able to send a message to a connected client on-the-fly during the execution of various methods and controllers.

Example C# console app that can connect to Websocket (tested):
https://gist.github.com/arbitmcdonald/4cf0f784b9fdc8430e51317eb693dcd9

Rachet PHP (Websockets for PHP):
http://socketo.me/

I've actually got this up and running myself (without MySQL for now) but I'm not happy with my implementation. Feel free to run with what I have so far:

Socket.php library for CI4:
https://gist.github.com/arbitmcdonald/e9a3e6bf408b31010837207cf1cffc55

Server.php controller for CI4:
https://gist.github.com/arbitmcdonald/ff4fe12c192690c41a2d05edb9e4a210

You can obviously start from scratch if preferred, and I don't mind which websocket library you use as long as it's actively supported and recently updated.

You do not need to use the C# app, use a Chrome extension or a mini JS websocket client for now for testing, I don't mind. For example: https://chrome.google.com/webstore/detail/smart-websocket-client/omalebghpgejjiaoknljcfmglgbpocdp or this simple JS websocket client: https://gist.github.com/arbitmcdonald/772e2e2e9c3d481d7f9439d769448632

Important info regarding quotes:

This is step 1 on a 15 step project. I do not want the code to be production-ready. I don't want any forms/views/UIs created. I'm simply looking to see someone else's approach to handling socket connections in MySQL, and sending messages to clients.

Essentially, this project will look like this:

- Create a new CI4 project using composer
- Select and install your chosen Websocket library
- Accept client connections and store connection data in DB
- Allow for sending of messages to specific clients from PHP workflows
- Deliver
Related categories: PHP Software Architecture MySQL Socket IO