php - Call my function instead anonymous function -
i have anonymous function running in onconnect event. how call function onconnect() instead anonymous function ?
$this->server->on("connect", function (websockettransportinterface $user) { $this->logger->notice((" connected " . $user->getip())); }); and
public function onconnect(websockettransportinterface $user) { $this->logger->notice((" connected " . $user->getip())); } something
$this->server->on("connect", onconnect($user));
just this
$this->server->on("connect", 'onconnect'); and if in same class, this:
$this->server->on("connect", array($this, 'onconnect'));
Comments
Post a Comment