-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix docs * fix oops
- Loading branch information
Showing
9 changed files
with
92 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
use stateroom_wasm::{ | ||
stateroom_wasm, ClientId, MessageRecipient, StateroomContext, StateroomService, MessagePayload | ||
}; | ||
use stateroom_wasm::*; | ||
|
||
#[stateroom_wasm] | ||
#[derive(Default)] | ||
struct BinaryEcho; | ||
|
||
impl StateroomService for BinaryEcho { | ||
fn message(&mut self, _: ClientId, message: MessagePayload, ctx: &impl StateroomContext) { | ||
let message = match message { | ||
MessagePayload::Text(s) => MessagePayload::Bytes(s.as_bytes().to_vec()), | ||
MessagePayload::Bytes(b) => MessagePayload::Text(format!("{:?}", b)), | ||
}; | ||
ctx.send_message(MessageRecipient::Broadcast, message); | ||
if let Some(message) = message.text() { | ||
ctx.send_message(MessageRecipient::Broadcast, message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters