### ChatServiceImpl.java - CDI bean with @ApplicationScoped and @Inject ZeroZDbNode Source: https://zeroz4j.com/ Server-side CDI bean that implements ChatService. The sendMessage method receives the exact ChatMessage object sent from the client and writes it to the local database using ZeroZDbNode. No controller, deserialisation, or mapping code is needed. ```java @ApplicationScoped public class ChatServiceImpl implements ChatService { @Inject ZeroZDbNode db; @Override public void sendMessage(ChatMessage msg) { // the exact object sent from the client db.localDb().write(ctx -> { root.getMessages().add(msg); ctx.store(root.getMessages()); }); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.