Connect client middleware