
const add_message = (from, message ) => {
	const div_thread = document.getElementById('chat_api_msg_thread');

	div_thread.appendChild(build_new_message(from, message));
}

const build_new_message = (from, message) => {
	const div = document.createElement("div");
	const p_name = document.createElement("p");
	const p_msg = document.createElement("p");

	div.classList.add("chat_msg");
	div.classList.add(from);
	p_name.classList.add("name");
	p_msg.classList.add("msg");

	p_name.appendChild(document.createTextNode(from + " :"));
	p_msg.appendChild(document.createTextNode(message));
	div.appendChild(p_name);
	div.appendChild(p_msg);

	return div;
}

/*
	<div class="chat_msg bob">
		<p class="name">bob</p>
		<p class="msg">hello</p>
	</div>
*/

