[feature] because the resolution of the event dispatcher is one second

we can use this as a timeout of our application when we wait for an event.
[feat] reconnection upon disconnection or connection error

there is one problem whenever the connection has been broken while sending keepalive
will be fixed with the next commit