add socket learning code