summaryrefslogtreecommitdiff
path: root/src/push/app.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/push/app.rs')
-rw-r--r--src/push/app.rs47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/push/app.rs b/src/push/app.rs
index ed8bf31..d16267a 100644
--- a/src/push/app.rs
+++ b/src/push/app.rs
@@ -46,53 +46,6 @@ impl<'a> Push<'a> {
Ok(id)
}
- pub async fn broadcast(
- &self,
- message: &str,
- ) -> Result<(), EchoError> {
- let mut tx = self.db.begin().await?;
- let subscriptions = tx
- .subscriptions()
- .all()
- .await?;
-
- tx.commit().await?;
-
- for subscription in subscriptions {
- // We don't care if any of these error, for now.
- // Eventually, we should remove rows that cause certain error conditions.
- println!("Sending to {:#?}", subscription.info.endpoint);
- self.send(&subscription.info, message).await.unwrap_or_else(|err| {
- println!("Error with {:#?}: {}", subscription.info.endpoint, err);
- })
- }
-
- Ok(())
- }
-
- pub async fn echo(
- &self,
- user: &User,
- endpoint: &String,
- message: &str,
- ) -> Result<(), EchoError> {
- let mut tx = self.db.begin().await?;
- let subscription = tx
- .subscriptions()
- .by_endpoint(endpoint)
- .await
- .not_found(|| EchoError::NotFound(endpoint.clone()))?;
- if subscription.user != user.id {
- return Err(EchoError::NotSubscriber(subscription.id, user.id.clone()));
- }
-
- tx.commit().await?;
-
- self.send(&subscription.info, message).await?;
-
- Ok(())
- }
-
async fn send(&self, subscription: &SubscriptionInfo, message: &str) -> Result<(), EchoError> {
let sig_builder = self
.vapid_signer