When the case is finally submitted to the jury, they may decide in court or retire for deliberation. If they retire, they must be kept together in some convenient place, under the charge of an officer, until they agree upon a verdict, or are discharged by the court, subject to the discretion of the court to permit them to separate temporarily at night and at their meals. The officer having them under his charge shall not suffer any communication to be made to them, or make any himself, except to ask them if they have agreed upon their verdict, unless by order of the court, and he shall not, before the verdict is rendered, communicate to any person the state of their deliberations or the verdict agreed upon.