add connection class, and now server can set callbacks