|
|
@ -26,6 +26,7 @@ impl MessageResponse {
|
|
|
|
enum MessageResponseData {
|
|
|
|
enum MessageResponseData {
|
|
|
|
Greeting {
|
|
|
|
Greeting {
|
|
|
|
id: u64,
|
|
|
|
id: u64,
|
|
|
|
|
|
|
|
next_mora: Option<String>,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Word {
|
|
|
|
Word {
|
|
|
|
author: u64,
|
|
|
|
author: u64,
|
|
|
@ -165,7 +166,8 @@ impl Server {
|
|
|
|
fn handle_connection(&mut self, client_id: u64, responder: Responder) -> Result<(), ServerError> {
|
|
|
|
fn handle_connection(&mut self, client_id: u64, responder: Responder) -> Result<(), ServerError> {
|
|
|
|
println!("A client connected with id #{}", client_id);
|
|
|
|
println!("A client connected with id #{}", client_id);
|
|
|
|
responder.send(MessageResponseData::Greeting {
|
|
|
|
responder.send(MessageResponseData::Greeting {
|
|
|
|
id: client_id
|
|
|
|
id: client_id,
|
|
|
|
|
|
|
|
next_mora: self.next_mora.clone(),
|
|
|
|
}.into_message());
|
|
|
|
}.into_message());
|
|
|
|
responder.send(MessageResponseData::History {
|
|
|
|
responder.send(MessageResponseData::History {
|
|
|
|
words: self.database.load_words_before(self.database.last_word_id + 1)?
|
|
|
|
words: self.database.load_words_before(self.database.last_word_id + 1)?
|
|
|
|