Skip to content

Commit

Permalink
Streaming flow support
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Nov 20, 2024
1 parent 1167ed6 commit 582a273
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nodejshelper/bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ));
Expand Down Expand Up @@ -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')));
Expand Down

0 comments on commit 582a273

Please sign in to comment.