Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 4 Websocket
#1
Heart 
(This post was last modified: 12-23-2019, 09:35 PM by takielias. Edit Reason: Remove Extra space and Github Link Update. )

I have been working for a few weeks to make a simple Websocket Library for Codeigniter 4

What is Codeigniter Websocket?

[Image: 71280886-acce1c00-2386-11ea-95d7-23e1775d3724.png]

CodeIgniter WebSocket library. It allows you to make powerful realtime applications by using Ratchet Socketo.me Websocket technology.

- Secure Auth system using Json Web Token
- Fully customize callback functions to handle different events

Though it's on the Beta version, you may give a try.

Installation

Code:
composer require takielias/codeigniter4-websocket @dev

Publishing Resource

You need to publish the resources for the default configuration

Code:
php spark websocket:publish

Usage

First start CodeIgniter

Code:
php spark serve

If you run the server in a different port, follow the command below.

Code:
php spark serve --port=9092

Finally start Websocket Server

Code:
php public/index.php Websocket start

WOW, You made it !!! ✔️

Open two pages of your project on the following URL with different IDs :

For default Port

Code:
http://localhost:8080/Websocket/user/1
Code:
http://localhost:8080/Websocket/user/2

For custom Port

Code:
http://localhost:9092/Websocket/user/1
Code:
http://localhost:9092/Websocket/user/2

Github Link: CodeIgniter 4 WebSocket Library

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. Smile
Reply
#2

Thank you very much, I don't know much about websocket but I always need to start the server to make it work or does it work ??
Reply
#3

(05-02-2020, 07:49 AM)xteksuox Wrote: Thank you very much, I don't know much about websocket but I always need to start the server to make it work or does it work ??

yes It works.
Reply
#4

This looks awesome, does it do pub/sub too?

I'm looking for a websocket I can subscribe to topics with.
Reply
#5

Hey! Very interesting.

Have you load tested this? I'm curious how many sockets you can support on a basic server like an t3.medium instance.

Any chance you have some unit tests?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#6

(This post was last modified: 06-10-2021, 08:36 AM by takielias.)

(03-03-2021, 03:05 PM)kristianlake Wrote: This looks awesome, does it do pub/sub too?

I'm looking for a websocket I can subscribe to topics with.

It does not have pub/sub.

(03-03-2021, 08:04 PM)albertleao Wrote: Hey! Very interesting.

Have you load tested this? I'm curious how many sockets you can support on a basic server like an t3.medium instance.

Any chance you have some unit tests?

Maybe 400/450. You may check this https://serverfault.com/a/862418 OR https://github.com/takielias/codeigniter...-806325042
Reply




Theme © iAndrew 2016 - Forum software by © MyBB