diff --git a/lib/modules/Protocols.pmod/WebSocket.pmod b/lib/modules/Protocols.pmod/WebSocket.pmod
index 914efd2a2d4af1f891a2713c29dffdb5cc5b1216..bd74ac3907e1aff9a2d0f84187e397910a84f171 100644
--- a/lib/modules/Protocols.pmod/WebSocket.pmod
+++ b/lib/modules/Protocols.pmod/WebSocket.pmod
@@ -358,7 +358,7 @@ class Connection {
 		  // websocket callback handlers
           masking = 1; // RFC6455 dictates that clients always use masking!
           state = OPEN;
-          if (onopen) onopen(id || this);
+          if (onopen) onopen(this_program::id || this);
 
           if (sizeof(http_buffer))
             websocket_in(id, http_buffer->read());