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

 xo::mr::connchan[i] send_to_subscriber key msg

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

Write directly to the subscribers from the connection thread via ns_connchan. It would be possible, to perform asynchronous operations via "ns_connchan callback", which would be handled in the background. Not sure, this is necessary.

Parameters:
key (required)
msg (required)

Testcases:
No testcase defined.
Source code:
#
# Write directly to the subscribers from the connection thread
# via ns_connchan. 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
  }
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: