diff --git a/src/context.rs b/src/context.rs
index 1702c8c32..614184d1d 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -167,6 +167,13 @@ impl HttpContext where A: Actor {
}
self.stream.as_mut().map(|s| s.push(frame));
}
+
+ /// Handle of the running future
+ ///
+ /// SpawnHandle is the handle returned by `AsyncContext::spawn()` method.
+ pub fn handle(&self) -> SpawnHandle {
+ self.inner.curr_handle()
+ }
}
impl ActorHttpContext for HttpContext where A: Actor, S: 'static {
diff --git a/src/ws/context.rs b/src/ws/context.rs
index 001b90185..6c0598b7e 100644
--- a/src/ws/context.rs
+++ b/src/ws/context.rs
@@ -191,6 +191,13 @@ impl WebsocketContext where A: Actor {
}
self.stream.as_mut().map(|s| s.push(frame));
}
+
+ /// Handle of the running future
+ ///
+ /// SpawnHandle is the handle returned by `AsyncContext::spawn()` method.
+ pub fn handle(&self) -> SpawnHandle {
+ self.inner.curr_handle()
+ }
}
impl ActorHttpContext for WebsocketContext where A: Actor, S: 'static {