Method: Mosquitto::Client#on_subscribe
- Defined in:
- ext/mosquitto/client.c
#on_subscribe {|mid, granted_qos| ... } ⇒ Boolean
Set the subscribe callback. This is called when the broker responds to a subscription request.
2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 |
# File 'ext/mosquitto/client.c', line 2092
static VALUE rb_mosquitto_client_on_subscribe(int argc, VALUE *argv, VALUE obj)
{
VALUE proc, cb;
MosquittoGetClient(obj);
rb_scan_args(argc, argv, "01&", &proc, &cb);
MosquittoAssertCallback(cb, 2);
if (!NIL_P(client->subscribe_cb)) rb_gc_unregister_address(&client->subscribe_cb);
mosquitto_subscribe_callback_set(client->mosq, rb_mosquitto_client_on_subscribe_cb);
client->subscribe_cb = cb;
rb_gc_register_address(&client->subscribe_cb);
return Qtrue;
}
|