Skip to content

Commit 582a273

Browse files
committed
Streaming flow support
1 parent 1167ed6 commit 582a273

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

nodejshelper/bootstrap/bootstrap.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function run() {
2222
$dispatcher->listen('chat.data_changed_chat', array( $this,'messageReceived' ));
2323
$dispatcher->listen('chat.screenshot_ready', array( $this,'messageReceived' ));
2424

25+
$dispatcher->listen('chat.stream_flow', array( $this,'streamFlow' ));
2526
$dispatcher->listen('chat.web_add_msg_admin', array( $this,'messageReceivedAdmin' ));
2627
$dispatcher->listen('chat.added_operation', array( $this,'messageReceivedAdmin' ));
2728
$dispatcher->listen('chat.chatwidgetchat', array( $this,'messageReceived' ));
@@ -124,6 +125,16 @@ public function __get($var)
124125
}
125126
}
126127

128+
129+
130+
public function streamFlow($params) {
131+
if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('automated_hosting')){
132+
erLhcoreClassNodeJSRedis::instance()->publish('chat_' . erLhcoreClassInstance::getInstance()->id . '_' . $params['chat']->id,'o:' . json_encode(array('msg' => $params['response']['content'], 'op' => 'sflow')));
133+
} else {
134+
erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('msg' => $params['response']['content'], 'op' => 'sflow')));
135+
}
136+
}
137+
127138
public function messageReceivedAdmin($params) {
128139
if (isset($params['ou']) && $params['ou'] instanceof erLhcoreClassModelChatOnlineUser && $params['chat']->user_status == erLhcoreClassModelChat::USER_STATUS_PENDING_REOPEN) {
129140
erLhcoreClassNodeJSRedis::instance()->publish('uo_' . $params['ou']->vid,'o:' . json_encode(array('op' => 'check_message')));

0 commit comments

Comments
 (0)