How to use If Condition in viaSocket