Method: Mosquitto::Client#on_message
- Defined in:
- ext/mosquitto/client.c
#on_message {|msg| ... } ⇒ Boolean
Set the message callback. This is called when a message is received from the broker.
2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 |
# File 'ext/mosquitto/client.c', line 2062
static VALUE rb_mosquitto_client_on_message(int argc, VALUE *argv, VALUE obj)
{
VALUE proc, cb;
MosquittoGetClient(obj);
rb_scan_args(argc, argv, "01&", &proc, &cb);
MosquittoAssertCallback(cb, 1);
if (!NIL_P(client->message_cb)) rb_gc_unregister_address(&client->message_cb);
mosquitto_message_callback_set(client->mosq, rb_mosquitto_client_on_message_cb);
client->message_cb = cb;
rb_gc_register_address(&client->message_cb);
return Qtrue;
}
|