Package com.example.server.sender
Interface MessageSender
- All Known Implementing Classes:
SimpleMessageSender
public interface MessageSender
Interface for sending messages to clients in a chat application.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
sendLastMessages
(ChatClient client) Sends the last messages to a specific client upon connecting.void
sendMessage
(ChatClient client, String message) Sends a message to a specific client.void
sendMessageToClient
(String nickname, String message, ChatInterface chatClient) Sends a message to a specific client identified by their nickname.
-
Method Details
-
sendMessageToClient
void sendMessageToClient(String nickname, String message, ChatInterface chatClient) throws IOException Sends a message to a specific client identified by their nickname.- Parameters:
nickname
- The nickname of the client to whom the message is sent.message
- The message to be sent to the client.chatClient
- The ChatInterface managing the client connections.- Throws:
IOException
- if an I/O error occurs while sending the message.
-
sendMessage
Sends a message to a specific client.- Parameters:
client
- The ChatClient to whom the message is sent.message
- The message to be sent to the client.- Throws:
IOException
- if an I/O error occurs while sending the message.
-
sendLastMessages
Sends the last messages to a specific client upon connecting.- Parameters:
client
- The ChatClient to whom the last messages are sent.- Throws:
IOException
- if an I/O error occurs while sending the last messages.
-