xo::mr::connchan proc subscribe (public)

 xo::mr::connchan[i] subscribe [ -initmsg initmsg ] [ -mode mode ] key

Defined in packages/xotcl-core/tcl/message-relay-procs.tcl

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"

Switches:
-initmsg (optional)
-mode (optional)
Parameters:
key (required)

Testcases:
No testcase defined.
Source code:
#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
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: