implement onClose callbacks
implement reconnect