Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with CodeIgniter 4.5.2 #15

Open
Sosko opened this issue Jun 28, 2024 · 1 comment
Open

Not working with CodeIgniter 4.5.2 #15

Sosko opened this issue Jun 28, 2024 · 1 comment

Comments

@Sosko
Copy link

Sosko commented Jun 28, 2024

I was using older CodeIgniter version 4.4.* with this library, but after I updated to the version 4.5.2 (and fix breaking changes) the library would't load and I getting this error:

CRITICAL - 2024-06-28 07:37:11 --> Error: Call to a member function set_callback() on null
[Method: CLI, Route: webserver]
in APPPATH/Controllers/Websocket.php on line 41.
 1 SYSTEMPATH/CodeIgniter.php(933): App\Controllers\Websocket->start()
 2 SYSTEMPATH/CodeIgniter.php(509): CodeIgniter\CodeIgniter->runController()
 3 SYSTEMPATH/CodeIgniter.php(355): CodeIgniter\CodeIgniter->handleRequest()
 4 SYSTEMPATH/Boot.php(325): CodeIgniter\CodeIgniter->run()
 5 SYSTEMPATH/Boot.php(67): CodeIgniter\Boot::runCodeIgniter()
 6 FCPATH/index.php(56): CodeIgniter\Boot::bootWeb(

The code in start is of class is:

namespace App\Controllers;

use CodeIgniter\Controller;
use App\Libraries\CodeigniterWebsocket;

class Websocket extends Controller {

    /**
     * @var Config
     */
    protected $config;

    /**
     * @var CodeigniterWebsocket 
     */
    protected  $service = null;

    public function __construct() {
        $this->config = config('CodeigniterWebsocket');
    }

    public function start() {
        $this->service = service('CodeigniterWebsocket');
        $this->service->set_callback('auth', array($this, '_auth')); // line 41
        $this->service->set_callback('citimer', array($this, 'citimer'));
        $this->service->set_callback('event', array($this, '_event'));
        $this->service->set_callback('watched', array($this, 'watched'));
        while (true) {
            try {
                $this->service->run();
            } catch (Exception $exc) {
                $this->logger->error($exc->getTraceAsString());
            }
        }
    }
.....
@takielias
Copy link
Owner

@Sosko Feel free to make a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants