Method: Mosquitto::Client#on_disconnect
- Defined in:
- ext/mosquitto/client.c
#on_disconnect {|rc| ... } ⇒ Boolean
Set the disconnect callback. This is called when the broker has received the DISCONNECT command and has disconnected the client.
2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 |
# File 'ext/mosquitto/client.c', line 2006
static VALUE rb_mosquitto_client_on_disconnect(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->disconnect_cb)) rb_gc_unregister_address(&client->disconnect_cb);
mosquitto_disconnect_callback_set(client->mosq, rb_mosquitto_client_on_disconnect_cb);
client->disconnect_cb = cb;
rb_gc_register_address(&client->disconnect_cb);
return Qtrue;
}
|