diff --git a/src/Ratchet/WebSocket/WsServer.php b/src/Ratchet/WebSocket/WsServer.php
index c05fe84..43c98a6 100644
--- a/src/Ratchet/WebSocket/WsServer.php
+++ b/src/Ratchet/WebSocket/WsServer.php
@@ -166,7 +166,7 @@ class WsServer implements HttpServerInterface {
      */
     public function onError(ConnectionInterface $conn, \Exception $e) {
         if ($this->connections->contains($conn)) {
-            $this->delegate->onError($this->connections[$from]->connection, $e);
+            $this->delegate->onError($this->connections[$conn]->connection, $e);
         } else {
             $conn->close();
         }