add socket mode support