/** * Push to websocket's topic after post save so user can instantly see the post * @inherit */ public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); //privado if ($insert) { if ($this->referencia_tipo == self::REF_MENSAJE) { NotificacionHelper::actualizarMensajesSinLeerWeb($this->conversacion->propietario, $this); } } }
/** * Push to websocket's topic after post save so user can instantly see the post * @inherit */ public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); //privado if ($insert) { $finalHtmlPri = Html::tag('li', 'Notificacion a usuario: ' . $this->usuarios->nombre, ['id' => $this->idarticulo]); $topicPub = \Yii::$app->websocket->topicPublico; // . $this->autor; $topicPri = \Yii::$app->websocket->topicPrivado . $this->usuario; \Yii::$app->websocket->enviarNotificacion(['topicNombre' => $topicPri, 'html' => $finalHtmlPri]); NotificacionHelper::actualizarMenuCategorias($this->categoria); } }