Method: Mosquitto::Client#on_connect
- Defined in:
- ext/mosquitto/client.c
#on_connect {|rc| ... } ⇒ Boolean
Set the connect callback. This is called when the broker sends a CONNACK message in response to a connection.
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 |
# File 'ext/mosquitto/client.c', line 1976
static VALUE rb_mosquitto_client_on_connect(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->connect_cb)) rb_gc_unregister_address(&client->connect_cb);
mosquitto_connect_callback_set(client->mosq, rb_mosquitto_client_on_connect_cb);
client->connect_cb = cb;
rb_gc_register_address(&client->connect_cb);
return Qtrue;
}
|