Question about set Spectating Entity!

Why does the server setSpectatingEntity and the client click to spectating the entity differently? When I call setSpectatingEntity on the server side, Players on the client side appear to be moving with a significant lag, not following smoothly . It seems that the camera is not synchronized. Do I need to send a package to the client side? what should i do?

The player moves like teleport, teleporting every second to the observing entity