From 582a273acb1222e7bde6f50e2bfd58079c74b85d Mon Sep 17 00:00:00 2001 From: Remigijus Kiminas Date: Wed, 20 Nov 2024 07:57:17 -0500 Subject: [PATCH] Streaming flow support --- nodejshelper/bootstrap/bootstrap.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nodejshelper/bootstrap/bootstrap.php b/nodejshelper/bootstrap/bootstrap.php index d4c9f53..3175e92 100644 --- a/nodejshelper/bootstrap/bootstrap.php +++ b/nodejshelper/bootstrap/bootstrap.php @@ -22,6 +22,7 @@ public function run() { $dispatcher->listen('chat.data_changed_chat', array( $this,'messageReceived' )); $dispatcher->listen('chat.screenshot_ready', array( $this,'messageReceived' )); + $dispatcher->listen('chat.stream_flow', array( $this,'streamFlow' )); $dispatcher->listen('chat.web_add_msg_admin', array( $this,'messageReceivedAdmin' )); $dispatcher->listen('chat.added_operation', array( $this,'messageReceivedAdmin' )); $dispatcher->listen('chat.chatwidgetchat', array( $this,'messageReceived' )); @@ -124,6 +125,16 @@ public function __get($var) } } + + + public function streamFlow($params) { + if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('automated_hosting')){ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . erLhcoreClassInstance::getInstance()->id . '_' . $params['chat']->id,'o:' . json_encode(array('msg' => $params['response']['content'], 'op' => 'sflow'))); + } else { + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('msg' => $params['response']['content'], 'op' => 'sflow'))); + } + } + public function messageReceivedAdmin($params) { if (isset($params['ou']) && $params['ou'] instanceof erLhcoreClassModelChatOnlineUser && $params['chat']->user_status == erLhcoreClassModelChat::USER_STATUS_PENDING_REOPEN) { erLhcoreClassNodeJSRedis::instance()->publish('uo_' . $params['ou']->vid,'o:' . json_encode(array('op' => 'check_message')));