- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class Relations
::xo::MessageRelay create ::xo::mr::connchan
Methods (to be applied on the object)
can_be_used (scripted)
return [expr {[info commands ::ns_connchan] ne ""}]
send_to_subscriber (scripted)
# # Write directly to the subscribers from the connection # thread. It would be possible, to perform asynchronous # operations via "ns_connchan callback", which would be handled # in the background. Not sure, this is necessary. # #ns_log notice "#### [self] send_to_subscriber <[nsv_array names mr_connchan_$key]>" foreach handle [nsv_array names mr_connchan_$key] { try { set mode [nsv_get mr_connchan_$key $handle] ns_connchan write $handle [:encode_message $mode $msg] } on error {errorMsg} { ns_log warning "message relay: duplicate registration for <$key> attempted" :cleanup $key $handle } }
subscribe (scripted)
#ns_log notice "#### [self] subscribe $key mode $mode" # # Unplug the connection channel from the current connection # thread. The currently unplugged channels can be queried via # "ns_connchan list" # set handle [ns_connchan detach] # # should check and append # if {![nsv_exists mr_connchan_$key $handle]} { nsv_set mr_connchan_$key $handle $mode try { ns_connchan write $handle [:start_of_page $mode] } on error {errorMsg} { ns_log warning "message relay: write on <$key> failed: $errorMsg" :cleanup $key $handle } } else { ns_log warning "message relay: duplicate registration for <$key> attempted" } #::bgdelivery do ::Subscriber new # -channel $ch -key $key # -user_id [ad_conn user_id] -mode $mode
sweep (scripted)
# # For the time being, do nothing. Since the chat is verbose on # logins/logouts, write operations will fail, in which case the # array is cleaned up. If this is not sufficient, probably a # "ns_connchan eof" operation would be useful. #
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables