Sending messages

Now that we can see the conversations that we've been having, we need to add the ability to take part in those conversations--to send new text messages. We'll start on the client. We've actually already seen the handler for the New Message button assigned. It is as follows:

    newMessageBtn.setOnAction(event -> sendNewMessage()); 

What we need to do now is to look at this sendNewMessage() method itself:

 private void sendNewMessage() { Optional<String> result = SendMessageDialogController .showAndWait(conversation.get()); if (result.isPresent()) { Conversation conv = conversation.get(); Message message = new Message(); message.setThreadId(conv.getThreadId()); message.setAddress(conv.getParticipant()); message.setBody(result.get()); ...

Get Java 9: Building Robust Modular Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.